Safe Haskell | None |
---|
Generalized versions of the functions
readProcess
, and
readProcessWithExitCode
.
- readCreateProcess :: (ListLikeLazyIO a c, ProcessOutput a b) => CreateProcess -> a -> IO b
- readCreateProcess' :: (ListLikeLazyIO a c, ProcessOutput a b) => CreateProcess -> a -> IO b
- readInterleaved :: forall a b c. (ListLikeLazyIO a c, ProcessOutput a b) => [(a -> b, Handle)] -> IO b -> IO b
- readCreateProcessWithExitCode :: ListLikeLazyIO a c => CreateProcess -> a -> IO (ExitCode, a, a)
- readProcessWithExitCode :: ListLikeLazyIO a c => FilePath -> [String] -> a -> IO (ExitCode, a, a)
- newtype StdoutWrapper a = StdoutWrapper {
- unStdoutWrapper :: a
- readProcess :: ListLikeLazyIO a c => FilePath -> [String] -> a -> IO a
Documentation
readCreateProcess :: (ListLikeLazyIO a c, ProcessOutput a b) => CreateProcess -> a -> IO bSource
Read the output of a process and use the argument functions to convert it into a Monoid, preserving the order of appearance of the different chunks of output from standard output and standard error.
readCreateProcess' :: (ListLikeLazyIO a c, ProcessOutput a b) => CreateProcess -> a -> IO bSource
readInterleaved :: forall a b c. (ListLikeLazyIO a c, ProcessOutput a b) => [(a -> b, Handle)] -> IO b -> IO bSource
Simultaneously read the output from several file handles, using the associated functions to add them to a Monoid b in the order they appear. This closes each handle on EOF, because AFAIK it is the only useful thing to do with a file handle that has reached EOF.
readCreateProcessWithExitCodeSource
:: ListLikeLazyIO a c | |
=> CreateProcess | process to run |
-> a | standard input |
-> IO (ExitCode, a, a) | exitcode, stdout, stderr |
An implementation of readProcessWithExitCode
with a two generalizations: (1) The input and outputs can be any
instance of ListLikeLazyIO
, and (2) The CreateProcess is passes an
argument, so you can use either proc
or
rawSystem
and you can modify its fields such as
cwd
before the process starts
:: ListLikeLazyIO a c | |
=> FilePath | command to run |
-> [String] | any arguments |
-> a | standard input |
-> IO (ExitCode, a, a) | exitcode, stdout, stderr |
A version of readProcessWithExitCode
that uses
any instance of ListLikeLazyIO
instead of String
, implemented
using readCreateProcessWithExitCode
.
newtype StdoutWrapper a Source
For the readProcess
function, we need to wrap a newtype around
the output type so we can build a ProcessOutput instance for it.
Otherwise it would overlap everything.
(ListLikeLazyIO a c, Monoid a) => ProcessOutput a (StdoutWrapper a) | |
Monoid a => Monoid (StdoutWrapper a) |
:: ListLikeLazyIO a c | |
=> FilePath | command to run |
-> [String] | any arguments |
-> a | standard input |
-> IO a | stdout |
Implementation of readProcess
that uses any
instance of ListLikeLazyIO
instead of String
, implemented using
readCreateProcess
. As with readProcess
, Stderr
goes directly to the console, only stdout is returned. Also like
readProcess
, an IO error of type OtherError is
thrown when the result code is not ExitSuccess.