Safe Haskell | None |
---|
- forkExecuteFile :: ByteString -> [ByteString] -> Maybe [(ByteString, ByteString)] -> Maybe ByteString -> Maybe (Source IO ByteString) -> Maybe (Sink ByteString IO ()) -> Maybe (Sink ByteString IO ()) -> IO ProcessHandle
- killProcess :: ProcessHandle -> IO ()
- terminateProcess :: ProcessHandle -> IO ()
- waitForProcess :: ProcessHandle -> IO ExitCode
- data ProcessStatus
- signalProcessHandle :: Signal -> ProcessHandle -> IO ()
- signalProcessHandleGroup :: Signal -> ProcessHandle -> IO ()
Documentation
:: ByteString | command |
-> [ByteString] | args |
-> Maybe [(ByteString, ByteString)] | environment |
-> Maybe ByteString | working directory |
-> Maybe (Source IO ByteString) | stdin |
-> Maybe (Sink ByteString IO ()) | stdout |
-> Maybe (Sink ByteString IO ()) | stderr |
-> IO ProcessHandle |
Fork a new process and execute the given command.
This is a wrapper around with fork() and exec*() syscalls, set up to work
with conduit
datatypes for standard input, output, and error. If Nothing
is provided for any of those arguments, then the original file handles will
remain open to the child process.
If you would like to simply discard data provided by the child process,
provide sinkNull
for stdout and/or stderr. To provide an empty input
stream, use return ()
.
Since 0.1.0
killProcess :: ProcessHandle -> IO ()Source
Kill a process by sending it the KILL (9) signal.
Since 0.1.0
terminateProcess :: ProcessHandle -> IO ()
Attempts to terminate the specified process. This function should
not be used under normal circumstances - no guarantees are given regarding
how cleanly the process is terminated. To check whether the process
has indeed terminated, use getProcessExitCode
.
On Unix systems, terminateProcess
sends the process the SIGTERM signal.
On Windows systems, the Win32 TerminateProcess
function is called, passing
an exit code of 1.
Note: on Windows, if the process was a shell command created by
createProcess
with shell
, or created by runCommand
or
runInteractiveCommand
, then terminateProcess
will only
terminate the shell, not the command itself. On Unix systems, both
processes are in a process group and will be terminated together.
waitForProcess :: ProcessHandle -> IO ExitCode
Waits for the specified process to terminate, and returns its exit code.
GHC Note: in order to call waitForProcess
without blocking all the
other threads in the system, you must compile the program with
-threaded
.
data ProcessStatus
signalProcessHandle :: Signal -> ProcessHandle -> IO ()Source
signalProcessHandleGroup :: Signal -> ProcessHandle -> IO ()Source