| Copyright | (c) The University of Glasgow 2004 |
|---|---|
| License | BSD-style (see the file libraries/base/LICENSE) |
| Maintainer | [email protected] |
| Stability | experimental |
| Portability | portable |
| Safe Haskell | Trustworthy |
| Language | Haskell2010 |
Note: This module exports internal implementation details that may change anytime. If you want a more stable API, use System.Process instead.
data ProcessHandle Source
A handle to a process, which can be used to wait for termination of the process using waitForProcess.
None of the process-creation functions in this library wait for termination: they all return a ProcessHandle which may be used to wait for the process later.
On Windows a second wait method can be used to block for event completion. This requires two handles. A process job handle and a events handle to monitor.
| ProcessHandle | |
Fields
| |
data ProcessHandle__ Source
| OpenHandle | |
Fields
| |
| OpenExtHandle |
|
Fields
| |
| ClosedHandle ExitCode | |
closePHANDLE :: PHANDLE -> IO () Source
mkProcessHandle :: PHANDLE -> Bool -> IO ProcessHandle Source
data CGid
| Bits CGid | |
Defined in GHC.Internal.System.Posix.Types Methodscomplement :: CGid -> CGid clearBit :: CGid -> Int -> CGid complementBit :: CGid -> Int -> CGid testBit :: CGid -> Int -> Bool bitSizeMaybe :: CGid -> Maybe Int unsafeShiftL :: CGid -> Int -> CGid unsafeShiftR :: CGid -> Int -> CGid rotateL :: CGid -> Int -> CGid | |
| FiniteBits CGid | |
Defined in GHC.Internal.System.Posix.Types MethodsfiniteBitSize :: CGid -> Int countLeadingZeros :: CGid -> Int countTrailingZeros :: CGid -> Int | |
| Bounded CGid | |
Defined in GHC.Internal.System.Posix.Types | |
| Enum CGid | |
| Storable CGid | |
Defined in GHC.Internal.System.Posix.Types | |
| Ix CGid | |
| Num CGid | |
| Read CGid | |
| Integral CGid | |
| Real CGid | |
Defined in GHC.Internal.System.Posix.Types MethodstoRational :: CGid -> Rational | |
| Show CGid | |
| Eq CGid | |
| Ord CGid | |
type UserID = CUid
modifyProcessHandle :: ProcessHandle -> (ProcessHandle__ -> IO (ProcessHandle__, a)) -> IO a Source
withProcessHandle :: ProcessHandle -> (ProcessHandle__ -> IO a) -> IO a Source
data CreateProcess Source
| CreateProcess | |
Fields
| |
| Show CreateProcess Source | |
Defined in System.Process.Common MethodsshowsPrec :: Int -> CreateProcess -> ShowS show :: CreateProcess -> String showList :: [CreateProcess] -> ShowS | |
| Eq CreateProcess Source | |
Defined in System.Process.Common Methods(==) :: CreateProcess -> CreateProcess -> Bool (/=) :: CreateProcess -> CreateProcess -> Bool | |
| ShellCommand String | A command line to execute using the shell |
| RawCommand FilePath [String] |
The name of an executable with a list of arguments The
Windows does not have a mechanism for passing multiple arguments. When using |
| IsString CmdSpec Source |
construct a Since: process-1.2.1.0 |
Defined in System.Process.Common MethodsfromString :: String -> CmdSpec | |
| Show CmdSpec Source | |
| Eq CmdSpec Source | |
| Inherit | Inherit Handle from parent |
| UseHandle Handle | Use the supplied Handle |
| CreatePipe | Create a new pipe. The returned |
| NoStream | Close the stream's file descriptor without passing a Handle. On POSIX systems this may lead to strange behavior in the child process because attempting to read or write after the file has been closed throws an error. This should only be used with child processes that don't use the file descriptor at all. If you wish to ignore the child process's output you should either create a pipe and drain it manually or pass a |
data ProcRetHandles Source
contains the handles returned by a call to createProcess_Internal
| ProcRetHandles | |
Fields
| |
| :: String |
Function name (for error messages). This can be any |
| -> CreateProcess | |
| -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) |
This function is almost identical to createProcess. The only differences are:
Handles provided via UseHandle are not closed automatically.String argument to be used in creating error messages.This function has been available from the System.Process.Internals module for some time, and is part of the System.Process module since version 1.2.1.0.
Since: process-1.2.1.0
| :: String | function name (for error messages) |
| -> CreateProcess | |
| -> Maybe CLong | handler for SIGINT |
| -> Maybe CLong | handler for SIGQUIT |
| -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) |
Deprecated: Please do not use this anymore, use the ordinary createProcess. If you need the SIGINT handling, use delegate_ctlc = True (runGenProcess_ is now just an imperfectly emulated stub that probably duplicates or overrides your own signal handling).
fdToHandle :: FD -> IO Handle
startDelegateControlC :: IO () Source
endDelegateControlC :: ExitCode -> IO () Source
stopDelegateControlC :: IO () Source
unwrapHandles :: ProcRetHandles -> (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) Source
pPrPr_disableITimers :: IO () Source
c_execvpe :: CString -> Ptr CString -> Ptr CString -> IO CInt Source
runInteractiveProcess_lock :: MVar () Source
runInteractiveProcess blocks signals around the fork(). Since blocking/unblocking of signals is a global state operation, we need to ensure mutual exclusion of calls to runInteractiveProcess. This lock is exported so that other libraries which also need to fork() (and also need to make the same global state changes) can protect their changes with the same lock. See https://github.com/haskell/process/pull/154.
Since: process-1.6.6.0
withFilePathException :: FilePath -> IO a -> IO a Source
withCEnvironment :: [(String, String)] -> (Ptr CString -> IO a) -> IO a Source
translate :: String -> String Source
createPipe :: IO (Handle, Handle) Source
Create a pipe for interprocess communication and return a (readEnd, writeEnd) Handle pair.
When this function is used with WinIO enabled it's the caller's responsibility to register the handles with the I/O manager. If this is not done the operation will deadlock. Association can be done as follows:
#if defined(IO_MANAGER_WINIO)
import GHC.IO.SubSystem ((!))
import GHC.IO.Handle.Windows (handleToHANDLE)
import GHC.Event.Windows (associateHandle')
#endif
...
#if defined (IO_MANAGER_WINIO)
return () ! (do
associateHandle' =handleToHANDLE <handle)
#endif
Only associate handles that you are in charge of read/writing to. Do not associate handles passed to another process. It's the process's reponsibility to register the handle if it supports async access.
Since: process-1.2.1.0
createPipeFd :: IO (FD, FD) Source
Create a pipe for interprocess communication and return a (readEnd, writeEnd) FD pair.
Since: process-1.4.2.0
interruptProcessGroupOf Source
| :: ProcessHandle | A process in the process group |
| -> IO () |
Sends an interrupt signal to the process group of the given process.
On Unix systems, it sends the group the SIGINT signal.
On Windows systems, it generates a CTRL_BREAK_EVENT and will only work for processes created using createProcess and setting the create_group flag
withForkWait :: IO () -> (IO () -> IO a) -> IO a Source
Fork a thread while doing something else, but kill it if there's an exception.
This is important in the cases above because we want to kill the thread that is holding the Handle lock, because when we clean up the process we try to close that handle, which could otherwise deadlock.
Since: process-1.6.20.0
ignoreSigPipe :: IO () -> IO () Source
Handle any SIGPIPE errors in the given computation.
Since: process-1.6.20.0
© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/9.12.1/docs/libraries/process-1.6.25.0-3038/System-Process-Internals.html