Safe Haskell | Safe-Infered |
---|
functions for killing processes, running processes, etc
- type Process = (Handle, Handle, Handle, ProcessHandle)
- data Output
- lazyRun :: MonadIO m => ByteString -> Process -> m Outputs
- lazyCommand :: MonadIO m => String -> ByteString -> m Outputs
- lazyProcess :: MonadIO m => FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> ByteString -> m Outputs
- stdoutOnly :: Outputs -> ByteString
- stderrOnly :: Outputs -> ByteString
- outputOnly :: Outputs -> ByteString
- checkResult :: (Int -> a) -> a -> Outputs -> a
- discardStdout :: Outputs -> Outputs
- discardStderr :: Outputs -> Outputs
- discardOutput :: Outputs -> Outputs
- mergeToStderr :: Outputs -> Outputs
- mergeToStdout :: Outputs -> Outputs
- collectStdout :: Outputs -> (ByteString, Outputs)
- collectStderr :: Outputs -> (ByteString, Outputs)
- collectOutput :: Outputs -> (ByteString, ByteString, ExitCode)
- collectOutputUnpacked :: Outputs -> (String, String, ExitCode)
- collectResult :: Outputs -> (ExitCode, Outputs)
- data ExitCode
- exitCodeOnly :: Outputs -> ExitCode
- hPutNonBlocking :: Handle -> ByteString -> IO Int64
- killByCwd :: FilePath -> IO [(String, Maybe String)]
Lazy process running
type Process = (Handle, Handle, Handle, ProcessHandle)Source
This is the type returned by runInteractiveProcess
et. al.
The lazyCommand, lazyProcess and lazyRun functions each return a
list of Output
. There will generally be one Result value at or
near the end of the list (if the list has an end.)
lazyRun :: MonadIO m => ByteString -> Process -> m OutputsSource
Take the tuple like that returned by runInteractiveProcess
,
create a process, send the list of inputs to its stdin and return
the lazy list of Output
objects.
lazyCommand :: MonadIO m => String -> ByteString -> m OutputsSource
Create a process with runInteractiveCommand
and run it with lazyRun
.
lazyProcess :: MonadIO m => FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> ByteString -> m OutputsSource
Create a process with runInteractiveProcess
and run it with lazyRun
.
stdoutOnly :: Outputs -> ByteStringSource
Filter everything except stdout from the output list.
stderrOnly :: Outputs -> ByteStringSource
Filter everything except stderr from the output list.
outputOnly :: Outputs -> ByteStringSource
Filter the exit codes output list and merge the two output streams in the order they appear.
checkResult :: (Int -> a) -> a -> Outputs -> aSource
discardStdout :: Outputs -> OutputsSource
discardStderr :: Outputs -> OutputsSource
discardOutput :: Outputs -> OutputsSource
mergeToStderr :: Outputs -> OutputsSource
Turn all the Stdout text into Stderr, preserving the order.
mergeToStdout :: Outputs -> OutputsSource
Turn all the Stderr text into Stdout, preserving the order.
collectStdout :: Outputs -> (ByteString, Outputs)Source
Split out and concatenate Stdout
collectStderr :: Outputs -> (ByteString, Outputs)Source
Split out and concatenate Stderr
collectOutput :: Outputs -> (ByteString, ByteString, ExitCode)Source
Split out and concatenate both Stdout and Stderr, leaving only the exit code.
collectOutputUnpacked :: Outputs -> (String, String, ExitCode)Source
Collect all output, unpack and concatenate.
collectResult :: Outputs -> (ExitCode, Outputs)Source
Partition the exit code from the outputs.
data ExitCode
Defines the exit codes that a program can return.
ExitSuccess | indicates successful termination; |
ExitFailure Int | indicates program failure with an exit code. The exact interpretation of the code is operating-system dependent. In particular, some values may be prohibited (e.g. 0 on a POSIX-compliant system). |
exitCodeOnly :: Outputs -> ExitCodeSource
hPutNonBlocking :: Handle -> ByteString -> IO Int64Source
This belongs in Data.ByteString. See ticket 1070, http://hackage.haskell.org/trac/ghc/ticket/1070.