Safe Haskell | None |
---|---|
Language | Haskell98 |
Data.Conduit.Process.Typed
Description
The System.Process.Typed module from typed-process
, but with
added conduit helpers.
Synopsis
- createSink :: MonadIO m => StreamSpec STInput (ConduitM ByteString o m ())
- createSource :: MonadIO m => StreamSpec STOutput (ConduitM i ByteString m ())
- withProcess :: MonadUnliftIO m => ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> m a) -> m a
- withProcess_ :: MonadUnliftIO m => ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> m a) -> m a
- withLoggedProcess_ :: MonadUnliftIO m => ProcessConfig stdin stdoutIgnored stderrIgnored -> (Process stdin (ConduitM () ByteString m ()) (ConduitM () ByteString m ()) -> m a) -> m a
- byteStringInput :: ByteString -> StreamSpec STInput ()
- byteStringOutput :: StreamSpec STOutput (STM ByteString)
- checkExitCode :: MonadIO m => Process stdin stdout stderr -> m ()
- checkExitCodeSTM :: Process stdin stdout stderr -> STM ()
- closed :: StreamSpec anyStreamType ()
- createPipe :: StreamSpec anyStreamType Handle
- getExitCode :: MonadIO m => Process stdin stdout stderr -> m (Maybe ExitCode)
- getExitCodeSTM :: Process stdin stdout stderr -> STM (Maybe ExitCode)
- getStderr :: Process stdin stdout stderr -> stderr
- getStdin :: Process stdin stdout stderr -> stdin
- getStdout :: Process stdin stdout stderr -> stdout
- inherit :: StreamSpec anyStreamType ()
- mkStreamSpec :: StdStream -> (ProcessConfig () () () -> Maybe Handle -> IO (a, IO ())) -> StreamSpec streamType a
- nullStream :: StreamSpec anyStreamType ()
- proc :: FilePath -> [String] -> ProcessConfig () () ()
- readProcess :: MonadIO m => ProcessConfig stdin stdoutIgnored stderrIgnored -> m (ExitCode, ByteString, ByteString)
- readProcessInterleaved :: MonadIO m => ProcessConfig stdin stdoutIgnored stderrIgnored -> m (ExitCode, ByteString)
- readProcessInterleaved_ :: MonadIO m => ProcessConfig stdin stdoutIgnored stderrIgnored -> m ByteString
- readProcessStderr :: MonadIO m => ProcessConfig stdin stdout stderrIgnored -> m (ExitCode, ByteString)
- readProcessStderr_ :: MonadIO m => ProcessConfig stdin stdout stderrIgnored -> m ByteString
- readProcessStdout :: MonadIO m => ProcessConfig stdin stdoutIgnored stderr -> m (ExitCode, ByteString)
- readProcessStdout_ :: MonadIO m => ProcessConfig stdin stdoutIgnored stderr -> m ByteString
- readProcess_ :: MonadIO m => ProcessConfig stdin stdoutIgnored stderrIgnored -> m (ByteString, ByteString)
- runProcess :: MonadIO m => ProcessConfig stdin stdout stderr -> m ExitCode
- runProcess_ :: MonadIO m => ProcessConfig stdin stdout stderr -> m ()
- setChildGroup :: GroupID -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
- setChildGroupInherit :: ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
- setChildUser :: UserID -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
- setChildUserInherit :: ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
- setCloseFds :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
- setCreateGroup :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
- setCreateNewConsole :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
- setDelegateCtlc :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
- setDetachConsole :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
- setEnv :: [(String, String)] -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
- setEnvInherit :: ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
- setNewSession :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
- setStderr :: StreamSpec STOutput stderr -> ProcessConfig stdin stdout stderr0 -> ProcessConfig stdin stdout stderr
- setStdin :: StreamSpec STInput stdin -> ProcessConfig stdin0 stdout stderr -> ProcessConfig stdin stdout stderr
- setStdout :: StreamSpec STOutput stdout -> ProcessConfig stdin stdout0 stderr -> ProcessConfig stdin stdout stderr
- setWorkingDir :: FilePath -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
- setWorkingDirInherit :: ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr
- shell :: String -> ProcessConfig () () ()
- startProcess :: MonadIO m => ProcessConfig stdin stdout stderr -> m (Process stdin stdout stderr)
- stopProcess :: MonadIO m => Process stdin stdout stderr -> m ()
- unsafeProcessHandle :: Process stdin stdout stderr -> ProcessHandle
- useHandleClose :: Handle -> StreamSpec anyStreamType ()
- useHandleOpen :: Handle -> StreamSpec anyStreamType ()
- waitExitCode :: MonadIO m => Process stdin stdout stderr -> m ExitCode
- waitExitCodeSTM :: Process stdin stdout stderr -> STM ExitCode
- withProcessTerm :: ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> IO a) -> IO a
- withProcessTerm_ :: ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> IO a) -> IO a
- withProcessWait :: ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> IO a) -> IO a
- withProcessWait_ :: ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> IO a) -> IO a
- data ByteStringOutputException = ByteStringOutputException SomeException (ProcessConfig () () ())
- data ExitCodeException = ExitCodeException {
- eceExitCode :: ExitCode
- eceProcessConfig :: ProcessConfig () () ()
- eceStdout :: ByteString
- eceStderr :: ByteString
- data Process stdin stdout stderr
- data ProcessConfig stdin stdout stderr
- data StreamSpec (streamType :: StreamType) a
- data StreamType
Conduit specific stuff
createSink :: MonadIO m => StreamSpec STInput (ConduitM ByteString o m ()) Source #
Provide input to a process by writing to a conduit.
Since: 1.2.1
createSource :: MonadIO m => StreamSpec STOutput (ConduitM i ByteString m ()) Source #
Read output from a process by read from a conduit.
Since: 1.2.1
Generalized functions
withProcess :: MonadUnliftIO m => ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> m a) -> m a Source #
Same as withProcess
, but generalized to MonadUnliftIO
.
Since: 1.2.1
withProcess_ :: MonadUnliftIO m => ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> m a) -> m a Source #
Same as withProcess_
, but generalized to MonadUnliftIO
.
Since: 1.2.1
withLoggedProcess_ :: MonadUnliftIO m => ProcessConfig stdin stdoutIgnored stderrIgnored -> (Process stdin (ConduitM () ByteString m ()) (ConduitM () ByteString m ()) -> m a) -> m a Source #
Run a process, throwing an exception on a failure exit code. This will store all output from stdout and stderr in memory for better error messages. Note that this will require unbounded memory usage, so caveat emptor.
This will ignore any previous settings for the stdout and stderr
streams, and instead force them to use createSource
.
Since: 1.2.3
Reexports
byteStringInput :: ByteString -> StreamSpec STInput () #
byteStringOutput :: StreamSpec STOutput (STM ByteString) #
checkExitCode :: MonadIO m => Process stdin stdout stderr -> m () #
checkExitCodeSTM :: Process stdin stdout stderr -> STM () #
closed :: StreamSpec anyStreamType () #
createPipe :: StreamSpec anyStreamType Handle #
getExitCode :: MonadIO m => Process stdin stdout stderr -> m (Maybe ExitCode) #
getExitCodeSTM :: Process stdin stdout stderr -> STM (Maybe ExitCode) #
inherit :: StreamSpec anyStreamType () #
mkStreamSpec :: StdStream -> (ProcessConfig () () () -> Maybe Handle -> IO (a, IO ())) -> StreamSpec streamType a #
nullStream :: StreamSpec anyStreamType () #
proc :: FilePath -> [String] -> ProcessConfig () () () #
readProcess :: MonadIO m => ProcessConfig stdin stdoutIgnored stderrIgnored -> m (ExitCode, ByteString, ByteString) #
readProcessInterleaved :: MonadIO m => ProcessConfig stdin stdoutIgnored stderrIgnored -> m (ExitCode, ByteString) #
readProcessInterleaved_ :: MonadIO m => ProcessConfig stdin stdoutIgnored stderrIgnored -> m ByteString #
readProcessStderr :: MonadIO m => ProcessConfig stdin stdout stderrIgnored -> m (ExitCode, ByteString) #
readProcessStderr_ :: MonadIO m => ProcessConfig stdin stdout stderrIgnored -> m ByteString #
readProcessStdout :: MonadIO m => ProcessConfig stdin stdoutIgnored stderr -> m (ExitCode, ByteString) #
readProcessStdout_ :: MonadIO m => ProcessConfig stdin stdoutIgnored stderr -> m ByteString #
readProcess_ :: MonadIO m => ProcessConfig stdin stdoutIgnored stderrIgnored -> m (ByteString, ByteString) #
runProcess :: MonadIO m => ProcessConfig stdin stdout stderr -> m ExitCode #
runProcess_ :: MonadIO m => ProcessConfig stdin stdout stderr -> m () #
setChildGroup :: GroupID -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr #
setChildGroupInherit :: ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr #
setChildUser :: UserID -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr #
setChildUserInherit :: ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr #
setCloseFds :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr #
setCreateGroup :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr #
setCreateNewConsole :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr #
setDelegateCtlc :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr #
setDetachConsole :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr #
setEnv :: [(String, String)] -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr #
setEnvInherit :: ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr #
setNewSession :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr #
setStderr :: StreamSpec STOutput stderr -> ProcessConfig stdin stdout stderr0 -> ProcessConfig stdin stdout stderr #
setStdin :: StreamSpec STInput stdin -> ProcessConfig stdin0 stdout stderr -> ProcessConfig stdin stdout stderr #
setStdout :: StreamSpec STOutput stdout -> ProcessConfig stdin stdout0 stderr -> ProcessConfig stdin stdout stderr #
setWorkingDir :: FilePath -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr #
setWorkingDirInherit :: ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr #
shell :: String -> ProcessConfig () () () #
startProcess :: MonadIO m => ProcessConfig stdin stdout stderr -> m (Process stdin stdout stderr) #
stopProcess :: MonadIO m => Process stdin stdout stderr -> m () #
unsafeProcessHandle :: Process stdin stdout stderr -> ProcessHandle #
useHandleClose :: Handle -> StreamSpec anyStreamType () #
useHandleOpen :: Handle -> StreamSpec anyStreamType () #
waitExitCode :: MonadIO m => Process stdin stdout stderr -> m ExitCode #
waitExitCodeSTM :: Process stdin stdout stderr -> STM ExitCode #
withProcessTerm :: ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> IO a) -> IO a #
withProcessTerm_ :: ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> IO a) -> IO a #
withProcessWait :: ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> IO a) -> IO a #
withProcessWait_ :: ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> IO a) -> IO a #
data ByteStringOutputException #
Constructors
ByteStringOutputException SomeException (ProcessConfig () () ()) |
Instances
Show ByteStringOutputException | |
Defined in System.Process.Typed Methods showsPrec :: Int -> ByteStringOutputException -> ShowS show :: ByteStringOutputException -> String showList :: [ByteStringOutputException] -> ShowS | |
Exception ByteStringOutputException | |
Defined in System.Process.Typed Methods toException :: ByteStringOutputException -> SomeException fromException :: SomeException -> Maybe ByteStringOutputException displayException :: ByteStringOutputException -> String |
data ExitCodeException #
Constructors
ExitCodeException | |
Fields
|
Instances
Show ExitCodeException | |
Defined in System.Process.Typed Methods showsPrec :: Int -> ExitCodeException -> ShowS show :: ExitCodeException -> String showList :: [ExitCodeException] -> ShowS | |
Exception ExitCodeException | |
Defined in System.Process.Typed Methods toException :: ExitCodeException -> SomeException fromException :: SomeException -> Maybe ExitCodeException displayException :: ExitCodeException -> String |
data ProcessConfig stdin stdout stderr #
Instances
Show (ProcessConfig stdin stdout stderr) | |
Defined in System.Process.Typed Methods showsPrec :: Int -> ProcessConfig stdin stdout stderr -> ShowS show :: ProcessConfig stdin stdout stderr -> String showList :: [ProcessConfig stdin stdout stderr] -> ShowS | |
(stdin ~ (), stdout ~ (), stderr ~ ()) => IsString (ProcessConfig stdin stdout stderr) | |
Defined in System.Process.Typed Methods fromString :: String -> ProcessConfig stdin stdout stderr |
data StreamSpec (streamType :: StreamType) a #
Instances
Functor (StreamSpec streamType) | |
Defined in System.Process.Typed Methods fmap :: (a -> b) -> StreamSpec streamType a -> StreamSpec streamType b (<$) :: a -> StreamSpec streamType b -> StreamSpec streamType a | |
(streamType ~ STInput, res ~ ()) => IsString (StreamSpec streamType res) | |
Defined in System.Process.Typed Methods fromString :: String -> StreamSpec streamType res |
data StreamType #