| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Conduit.Process
Description
A full tutorial for this module is available at: https://github.com/snoyberg/conduit/blob/master/PROCESS.md.
Some utilities in this module require the threaded runtime because they use
waitForProcess internally.
Note that this is a very thin layer around the Data.Streaming.Process module. In particular, it:
- Provides orphan instances for conduit
- Provides some useful helper functions
Synopsis
- sourceCmdWithConsumer :: MonadIO m => String -> ConduitT ByteString Void m a -> m (ExitCode, a)
- sourceProcessWithConsumer :: MonadIO m => CreateProcess -> ConduitT ByteString Void m a -> m (ExitCode, a)
- sourceCmdWithStreams :: MonadUnliftIO m => String -> ConduitT () ByteString m () -> ConduitT ByteString Void m a -> ConduitT ByteString Void m b -> m (ExitCode, a, b)
- sourceProcessWithStreams :: MonadUnliftIO m => CreateProcess -> ConduitT () ByteString m () -> ConduitT ByteString Void m a -> ConduitT ByteString Void m b -> m (ExitCode, a, b)
- withCheckedProcessCleanup :: (InputSource stdin, OutputSink stderr, OutputSink stdout, MonadUnliftIO m) => CreateProcess -> (stdin -> stdout -> stderr -> m b) -> m b
- newtype FlushInput o (m :: Type -> Type) r = FlushInput (ConduitM (Flush ByteString) o m r)
- newtype BuilderInput o (m :: Type -> Type) r = BuilderInput (ConduitM Builder o m r)
- waitForProcess :: ProcessHandle -> IO ExitCode
- createProcess :: CreateProcess -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
- data ProcessHandle
- data StdStream
- data CmdSpec
- data CreateProcess = CreateProcess {
- cmdspec :: CmdSpec
- cwd :: Maybe FilePath
- env :: Maybe [(String, String)]
- std_in :: StdStream
- std_out :: StdStream
- std_err :: StdStream
- close_fds :: Bool
- create_group :: Bool
- delegate_ctlc :: Bool
- detach_console :: Bool
- create_new_console :: Bool
- new_session :: Bool
- child_group :: Maybe GroupID
- child_user :: Maybe UserID
- use_process_jobs :: Bool
- createProcess_ :: String -> CreateProcess -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
- createPipe :: IO (Handle, Handle)
- createPipeFd :: IO (FD, FD)
- interruptProcessGroupOf :: ProcessHandle -> IO ()
- type Pid = CPid
- proc :: FilePath -> [String] -> CreateProcess
- shell :: String -> CreateProcess
- withCreateProcess :: CreateProcess -> (Maybe Handle -> Maybe Handle -> Maybe Handle -> ProcessHandle -> IO a) -> IO a
- cleanupProcess :: (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -> IO ()
- spawnProcess :: FilePath -> [String] -> IO ProcessHandle
- spawnCommand :: String -> IO ProcessHandle
- callProcess :: FilePath -> [String] -> IO ()
- callCommand :: String -> IO ()
- readProcess :: FilePath -> [String] -> String -> IO String
- readCreateProcess :: CreateProcess -> String -> IO String
- readProcessWithExitCode :: FilePath -> [String] -> String -> IO (ExitCode, String, String)
- readCreateProcessWithExitCode :: CreateProcess -> String -> IO (ExitCode, String, String)
- showCommandForUser :: FilePath -> [String] -> String
- getPid :: ProcessHandle -> IO (Maybe Pid)
- getCurrentPid :: IO Pid
- getProcessExitCode :: ProcessHandle -> IO (Maybe ExitCode)
- terminateProcess :: ProcessHandle -> IO ()
- runCommand :: String -> IO ProcessHandle
- runProcess :: FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> Maybe Handle -> Maybe Handle -> Maybe Handle -> IO ProcessHandle
- runInteractiveCommand :: String -> IO (Handle, Handle, Handle, ProcessHandle)
- runInteractiveProcess :: FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> IO (Handle, Handle, Handle, ProcessHandle)
- system :: String -> IO ExitCode
- rawSystem :: String -> [String] -> IO ExitCode
- data StreamingProcessHandle
- class OutputSink a
- class InputSource a
- data ProcessExitedUnsuccessfully = ProcessExitedUnsuccessfully CreateProcess ExitCode
- data ClosedStream = ClosedStream
- data Inherited = Inherited
- data UseProvidedHandle = UseProvidedHandle
- waitForStreamingProcess :: MonadIO m => StreamingProcessHandle -> m ExitCode
- waitForStreamingProcessSTM :: StreamingProcessHandle -> STM ExitCode
- getStreamingProcessExitCode :: MonadIO m => StreamingProcessHandle -> m (Maybe ExitCode)
- getStreamingProcessExitCodeSTM :: StreamingProcessHandle -> STM (Maybe ExitCode)
- streamingProcessHandleRaw :: StreamingProcessHandle -> ProcessHandle
- streamingProcessHandleTMVar :: StreamingProcessHandle -> TMVar ExitCode
- streamingProcess :: (MonadIO m, InputSource stdin, OutputSink stdout, OutputSink stderr) => CreateProcess -> m (stdin, stdout, stderr, StreamingProcessHandle)
- closeStreamingProcessHandle :: MonadIO m => StreamingProcessHandle -> m ()
- withCheckedProcess :: (InputSource stdin, OutputSink stderr, OutputSink stdout, MonadIO m) => CreateProcess -> (stdin -> stdout -> stderr -> m b) -> m b
Functions
sourceCmdWithConsumer Source #
Like sourceProcessWithConsumer but providing the command to be run as
a String.
Requires the threaded runtime.
Since 1.1.2
sourceProcessWithConsumer Source #
Arguments
| :: MonadIO m | |
| => CreateProcess | |
| -> ConduitT ByteString Void m a | stdout |
| -> m (ExitCode, a) |
Given a CreateProcess, run the process, with its output being used as a
Source to feed the provided Consumer. Once the process has completed,
return a tuple of the ExitCode from the process and the output collected
from the Consumer.
Note that, if an exception is raised by the consumer, the process is not
terminated. This behavior is different from sourceProcessWithStreams due
to historical reasons.
Requires the threaded runtime.
Since 1.1.2
Arguments
| :: MonadUnliftIO m | |
| => String | command |
| -> ConduitT () ByteString m () | stdin |
| -> ConduitT ByteString Void m a | stdout |
| -> ConduitT ByteString Void m b | stderr |
| -> m (ExitCode, a, b) |
Like sourceProcessWithStreams but providing the command to be run as
a String.
Requires the threaded runtime.
Since: 1.1.12
sourceProcessWithStreams Source #
Arguments
| :: MonadUnliftIO m | |
| => CreateProcess | |
| -> ConduitT () ByteString m () | stdin |
| -> ConduitT ByteString Void m a | stdout |
| -> ConduitT ByteString Void m b | stderr |
| -> m (ExitCode, a, b) |
Given a CreateProcess, run the process
and feed the provided Producer
to the stdin Sink of the process.
Use the process outputs (stdout, stderr) as Sources
and feed it to the provided Consumers.
Once the process has completed,
return a tuple of the ExitCode from the process
and the results collected from the Consumers.
If an exception is raised by any of the streams, the process is terminated.
IO is required because the streams are run concurrently using the async package
Requires the threaded runtime.
Since: 1.1.12
withCheckedProcessCleanup :: (InputSource stdin, OutputSink stderr, OutputSink stdout, MonadUnliftIO m) => CreateProcess -> (stdin -> stdout -> stderr -> m b) -> m b Source #
Same as withCheckedProcess, but kills the child process in the case of
an exception being thrown by the provided callback function.
Requires the threaded runtime.
Since: 1.1.11
InputSource types
newtype FlushInput o (m :: Type -> Type) r Source #
Wrapper for input source which accepts Flushes. Note that the pipe
will not automatically close then processing completes.
Since: 1.3.2
Constructors
| FlushInput (ConduitM (Flush ByteString) o m r) |
Instances
| (MonadIO m, MonadIO n, r ~ (), r' ~ ()) => InputSource (FlushInput o m r, n r') Source # | |
Defined in Data.Conduit.Process Methods isStdStream :: (Maybe Handle -> IO (FlushInput o m r, n r'), Maybe StdStream) | |
| (MonadIO m, r ~ ()) => InputSource (FlushInput o m r) Source # | |
Defined in Data.Conduit.Process Methods isStdStream :: (Maybe Handle -> IO (FlushInput o m r), Maybe StdStream) | |
newtype BuilderInput o (m :: Type -> Type) r Source #
Wrapper for input source which accepts Builders.
You can pass flush to flush the input. Note
that the pipe will not automatically close when the processing completes.
Since: 1.3.2
Constructors
| BuilderInput (ConduitM Builder o m r) |
Instances
| (MonadIO m, MonadIO n, r ~ (), r' ~ ()) => InputSource (BuilderInput o m r, n r') Source # | |
Defined in Data.Conduit.Process Methods isStdStream :: (Maybe Handle -> IO (BuilderInput o m r, n r'), Maybe StdStream) | |
| (MonadIO m, r ~ ()) => InputSource (BuilderInput o m r) Source # | |
Defined in Data.Conduit.Process Methods isStdStream :: (Maybe Handle -> IO (BuilderInput o m r), Maybe StdStream) | |
Reexport
waitForProcess :: ProcessHandle -> IO ExitCode Source #
Waits for the specified process to terminate, and returns its exit code.
On Unix systems, may throw UserInterrupt when using delegate_ctlc.
GHC Note: in order to call waitForProcess without blocking all the
other threads in the system, you must compile the program with
-threaded.
Note that it is safe to call waitForProcess for the same process in multiple
threads. When the process ends, threads blocking on this call will wake in
FIFO order. When using delegate_ctlc and the process is interrupted, only
the first waiting thread will throw UserInterrupt.
(Since: 1.2.0.0) On Unix systems, a negative value
indicates that the child was terminated by signal ExitFailure -signumsignum.
The signal numbers are platform-specific, so to test for a specific signal use
the constants provided by System.Posix.Signals in the unix package.
Note: core dumps are not reported, use System.Posix.Process if you need this
detail.
createProcess :: CreateProcess -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) Source #
This is the most general way to spawn an external process. The
process can be a command line to be executed by a shell or a raw command
with a list of arguments. The stdin, stdout, and stderr streams of
the new process may individually be attached to new pipes, to existing
Handles, or just inherited from the parent (the default.)
The details of how to create the process are passed in the
CreateProcess record. To make it easier to construct a
CreateProcess, the functions proc and shell are supplied that
fill in the fields with default values which can be overriden as
needed.
createProcess returns (mb_stdin_hdl, mb_stdout_hdl, mb_stderr_hdl, ph),
where
- if
, thenstd_in==CreatePipemb_stdin_hdlwill beJust h, wherehis the write end of the pipe connected to the child process'sstdin. - otherwise,
mb_stdin_hdl == Nothing
Similarly for mb_stdout_hdl and mb_stderr_hdl.
For example, to execute a simple ls command:
r <- createProcess (proc "ls" [])
To create a pipe from which to read the output of ls:
(_, Just hout, _, _) <-
createProcess (proc "ls" []){ std_out = CreatePipe }To also set the directory in which to run ls:
(_, Just hout, _, _) <-
createProcess (proc "ls" []){ cwd = Just "/home/bob",
std_out = CreatePipe }Note that Handles provided for std_in, std_out, or std_err via the
UseHandle constructor will be closed by calling this function. This is not
always the desired behavior. In cases where you would like to leave the
Handle open after spawning the child process, please use createProcess_
instead. All created Handles are initially in text mode; if you need them
to be in binary mode then use hSetBinaryMode.
ph contains a handle to the running process. On Windows
use_process_jobs can be set in CreateProcess in order to create a
Win32 Job object to monitor a process tree's progress. If it is set
then that job is also returned inside ph. ph can be used to
kill all running sub-processes. This feature has been available since
1.5.0.0.
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.
Constructors
| 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 |
Constructors
| 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 |
Instances
| IsString CmdSpec | construct a Since: process-1.2.1.0 |
Defined in System.Process.Common Methods fromString :: String -> CmdSpec Source # | |
| Show CmdSpec | |
| Eq CmdSpec | |
data CreateProcess Source #
Constructors
| CreateProcess | |
Fields
| |
Instances
| Show CreateProcess | |
Defined in System.Process.Common | |
| Eq CreateProcess | |
Defined in System.Process.Common Methods (==) :: CreateProcess -> CreateProcess -> Bool Source # (/=) :: CreateProcess -> CreateProcess -> Bool Source # | |
Arguments
| :: 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 viaUseHandleare not closed automatically.- This function takes an extra
Stringargument 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
createPipe :: IO (Handle, Handle) Source #
Create a pipe for interprocess communication and return a
(readEnd, writeEnd) Handle pair.
- WinIO Support
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 readEnd
#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 responsibility 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 #
Arguments
| :: 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
The platform specific type for a process identifier.
This is always an integral type. Width and signedness are platform specific.
Since: process-1.6.3.0
proc :: FilePath -> [String] -> CreateProcess Source #
Construct a CreateProcess record for passing to createProcess,
representing a raw command with arguments.
See RawCommand for precise semantics of the specified FilePath.
shell :: String -> CreateProcess Source #
Construct a CreateProcess record for passing to createProcess,
representing a command to be passed to the shell.
withCreateProcess :: CreateProcess -> (Maybe Handle -> Maybe Handle -> Maybe Handle -> ProcessHandle -> IO a) -> IO a Source #
A bracket-style resource handler for createProcess.
Does automatic cleanup when the action finishes. If there is an exception
in the body then it ensures that the process gets terminated and any
CreatePipe Handles are closed. In particular this means that if the
Haskell thread is killed (e.g. killThread), that the external process is
also terminated.
e.g.
withCreateProcess (proc cmd args) { ... } $ \stdin stdout stderr ph -> do
...Since: process-1.4.3.0
cleanupProcess :: (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -> IO () Source #
Cleans up the process.
This function is meant to be invoked from any application level cleanup
handler. It terminates the process, and closes any CreatePipe handles.
Since: process-1.6.4.0
spawnProcess :: FilePath -> [String] -> IO ProcessHandle Source #
Creates a new process to run the specified raw command with the given
arguments. It does not wait for the program to finish, but returns the
ProcessHandle.
Since: process-1.2.0.0
spawnCommand :: String -> IO ProcessHandle Source #
Creates a new process to run the specified shell command.
It does not wait for the program to finish, but returns the ProcessHandle.
Since: process-1.2.0.0
callProcess :: FilePath -> [String] -> IO () Source #
Creates a new process to run the specified command with the given arguments, and wait for it to finish. If the command returns a non-zero exit code, an exception is raised.
If an asynchronous exception is thrown to the thread executing
callProcess, the forked process will be terminated and
callProcess will wait (block) until the process has been
terminated.
Since: process-1.2.0.0
callCommand :: String -> IO () Source #
Creates a new process to run the specified shell command. If the command returns a non-zero exit code, an exception is raised.
If an asynchronous exception is thrown to the thread executing
callCommand, the forked process will be terminated and
callCommand will wait (block) until the process has been
terminated.
Since: process-1.2.0.0
Arguments
| :: FilePath | Filename of the executable (see |
| -> [String] | any arguments |
| -> String | standard input |
| -> IO String | stdout |
readProcess forks an external process, reads its standard output
strictly, blocking until the process terminates, and returns the output
string. The external process inherits the standard error.
If an asynchronous exception is thrown to the thread executing
readProcess, the forked process will be terminated and readProcess will
wait (block) until the process has been terminated.
Output is returned strictly, so this is not suitable for launching processes that require interaction over the standard file streams.
This function throws an IOError if the process ExitCode is
anything other than ExitSuccess. If instead you want to get the
ExitCode then use readProcessWithExitCode.
Users of this function should compile with -threaded if they
want other Haskell threads to keep running while waiting on
the result of readProcess.
> readProcess "date" [] [] "Thu Feb 7 10:03:39 PST 2008\n"
The arguments are:
- The command to run, which must be in the $PATH, or an absolute or relative path
- A list of separate command line arguments to the program. See
RawCommandfor further discussion of Windows semantics. - A string to pass on standard input to the forked process.
Arguments
| :: CreateProcess | |
| -> String | standard input |
| -> IO String | stdout |
readCreateProcess works exactly like readProcess except that it
lets you pass CreateProcess giving better flexibility.
> readCreateProcess ((shell "pwd") { cwd = Just "/etc/" }) ""
"/etc\n"Note that Handles provided for std_in or std_out via the CreateProcess
record will be ignored.
Since: process-1.2.3.0
readProcessWithExitCode Source #
Arguments
| :: FilePath | Filename of the executable (see |
| -> [String] | any arguments |
| -> String | standard input |
| -> IO (ExitCode, String, String) | exitcode, stdout, stderr |
readProcessWithExitCode is like readProcess but with two differences:
- it returns the
ExitCodeof the process, and does not throw any exception if the code is notExitSuccess. - it reads and returns the output from process' standard error handle, rather than the process inheriting the standard error handle.
On Unix systems, see waitForProcess for the meaning of exit codes
when the process died as the result of a signal.
readCreateProcessWithExitCode Source #
Arguments
| :: CreateProcess | |
| -> String | standard input |
| -> IO (ExitCode, String, String) | exitcode, stdout, stderr |
readCreateProcessWithExitCode works exactly like readProcessWithExitCode except that it
lets you pass CreateProcess giving better flexibility.
Note that Handles provided for std_in, std_out, or std_err via the CreateProcess
record will be ignored.
Since: process-1.2.3.0
showCommandForUser :: FilePath -> [String] -> String Source #
Given a program p and arguments args,
showCommandForUser p args returns a string suitable for pasting
into /bin/sh (on Unix systems) or CMD.EXE (on Windows).
getPid :: ProcessHandle -> IO (Maybe Pid) Source #
Returns the PID (process ID) of a subprocess.
Nothing is returned if the handle was already closed. Otherwise a
PID is returned that remains valid as long as the handle is open.
The operating system may reuse the PID as soon as the last handle to
the process is closed.
Since: process-1.6.3.0
getCurrentPid :: IO Pid Source #
Returns the PID (process ID) of the current process. On POSIX systems,
this calls getProcessID from System.Posix.Process in the unix package.
On Windows, this calls getCurrentProcessId from System.Win32.Process in
the Win32 package.
Since: process-1.6.12.0
getProcessExitCode :: ProcessHandle -> IO (Maybe ExitCode) Source #
This is a non-blocking version of waitForProcess. If the process is
still running, Nothing is returned. If the process has exited, then
is returned where Just ee is the exit code of the process.
On Unix systems, see waitForProcess for the meaning of exit codes
when the process died as the result of a signal. May throw
UserInterrupt when using delegate_ctlc.
terminateProcess :: ProcessHandle -> IO () Source #
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, if use_process_jobs is True then the Win32 TerminateJobObject
function is called to kill all processes associated with the job and passing the
exit code of 1 to each of them. Otherwise if use_process_jobs is False then 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.
runCommand :: String -> IO ProcessHandle Source #
Runs a command using the shell.
Arguments
| :: FilePath | Filename of the executable (see |
| -> [String] | Arguments to pass to the executable |
| -> Maybe FilePath | Optional path to the working directory |
| -> Maybe [(String, String)] | Optional environment (otherwise inherit) |
| -> Maybe Handle | Handle to use for |
| -> Maybe Handle | Handle to use for |
| -> Maybe Handle | Handle to use for |
| -> IO ProcessHandle |
Runs a raw command, optionally specifying Handles from which to
take the stdin, stdout and stderr channels for the new
process (otherwise these handles are inherited from the current
process).
Any Handles passed to runProcess are placed immediately in the
closed state.
Note: consider using the more general createProcess instead of
runProcess.
runInteractiveCommand :: String -> IO (Handle, Handle, Handle, ProcessHandle) Source #
Runs a command using the shell, and returns Handles that may
be used to communicate with the process via its stdin, stdout,
and stderr respectively.
runInteractiveProcess Source #
Arguments
| :: FilePath | Filename of the executable (see |
| -> [String] | Arguments to pass to the executable |
| -> Maybe FilePath | Optional path to the working directory |
| -> Maybe [(String, String)] | Optional environment (otherwise inherit) |
| -> IO (Handle, Handle, Handle, ProcessHandle) |
Runs a raw command, and returns Handles that may be used to communicate
with the process via its stdin, stdout and stderr respectively.
For example, to start a process and feed a string to its stdin:
(inp,out,err,pid) <- runInteractiveProcess "..." forkIO (hPutStr inp str)
system :: String -> IO ExitCode Source #
Computation system cmd returns the exit code produced when the
operating system runs the shell command cmd.
This computation may fail with one of the following
IOErrorType exceptions:
PermissionDenied- The process has insufficient privileges to perform the operation.
ResourceExhausted- Insufficient resources are available to perform the operation.
UnsupportedOperation- The implementation does not support system calls.
On Windows, system passes the command to the Windows command
interpreter (CMD.EXE or COMMAND.COM), hence Unixy shell tricks
will not work.
On Unix systems, see waitForProcess for the meaning of exit codes
when the process died as the result of a signal.
rawSystem :: String -> [String] -> IO ExitCode Source #
The computation runs the operating system command
rawSystem cmd argscmd in such a way that it receives as arguments the args strings
exactly as given, with no funny escaping or shell meta-syntax expansion.
It will therefore behave more portably between operating systems than system.
The return codes and possible failures are the same as for system.
data StreamingProcessHandle #
class OutputSink a #
Minimal complete definition
osStdStream
Instances
| OutputSink Handle | |
Defined in Data.Streaming.Process.Internal | |
| OutputSink ClosedStream | |
Defined in Data.Streaming.Process Methods osStdStream :: (Maybe Handle -> IO ClosedStream, Maybe StdStream) | |
| OutputSink Inherited | |
Defined in Data.Streaming.Process | |
| OutputSink UseProvidedHandle | |
Defined in Data.Streaming.Process Methods osStdStream :: (Maybe Handle -> IO UseProvidedHandle, Maybe StdStream) | |
| (r ~ (), r' ~ (), MonadIO m, MonadIO n, o ~ ByteString) => OutputSink (ConduitM i o m r, n r') Source # | |
Defined in Data.Conduit.Process | |
| (r ~ (), MonadIO m, o ~ ByteString) => OutputSink (ConduitM i o m r) Source # | |
Defined in Data.Conduit.Process | |
class InputSource a #
Minimal complete definition
isStdStream
Instances
data ProcessExitedUnsuccessfully #
Constructors
| ProcessExitedUnsuccessfully CreateProcess ExitCode |
Instances
data ClosedStream #
Constructors
| ClosedStream |
Instances
| InputSource ClosedStream | |
Defined in Data.Streaming.Process Methods isStdStream :: (Maybe Handle -> IO ClosedStream, Maybe StdStream) | |
| OutputSink ClosedStream | |
Defined in Data.Streaming.Process Methods osStdStream :: (Maybe Handle -> IO ClosedStream, Maybe StdStream) | |
Constructors
| Inherited |
Instances
| InputSource Inherited | |
Defined in Data.Streaming.Process | |
| OutputSink Inherited | |
Defined in Data.Streaming.Process | |
data UseProvidedHandle #
Constructors
| UseProvidedHandle |
Instances
| InputSource UseProvidedHandle | |
Defined in Data.Streaming.Process Methods isStdStream :: (Maybe Handle -> IO UseProvidedHandle, Maybe StdStream) | |
| OutputSink UseProvidedHandle | |
Defined in Data.Streaming.Process Methods osStdStream :: (Maybe Handle -> IO UseProvidedHandle, Maybe StdStream) | |
waitForStreamingProcess :: MonadIO m => StreamingProcessHandle -> m ExitCode #
getStreamingProcessExitCode :: MonadIO m => StreamingProcessHandle -> m (Maybe ExitCode) #
streamingProcess :: (MonadIO m, InputSource stdin, OutputSink stdout, OutputSink stderr) => CreateProcess -> m (stdin, stdout, stderr, StreamingProcessHandle) #
closeStreamingProcessHandle :: MonadIO m => StreamingProcessHandle -> m () #
withCheckedProcess :: (InputSource stdin, OutputSink stderr, OutputSink stdout, MonadIO m) => CreateProcess -> (stdin -> stdout -> stderr -> m b) -> m b #
Orphan instances
| (r ~ (), r' ~ (), MonadIO m, MonadIO n, i ~ ByteString) => InputSource (ConduitM i o m r, n r') Source # | |
| (r ~ (), r' ~ (), MonadIO m, MonadIO n, o ~ ByteString) => OutputSink (ConduitM i o m r, n r') Source # | |
| (r ~ (), MonadIO m, i ~ ByteString) => InputSource (ConduitM i o m r) Source # | |
| (r ~ (), MonadIO m, o ~ ByteString) => OutputSink (ConduitM i o m r) Source # | |