Commit d0a62be4 authored by Michael Snoyman's avatar Michael Snoyman
Browse files

readCreateProcessWithExitCode

parent dd3ff59b
......@@ -42,6 +42,7 @@ module System.Process (
spawnCommand,
readCreateProcess,
readProcess,
readCreateProcessWithExitCode,
readProcessWithExitCode,
-- ** Related utilities
......@@ -484,13 +485,27 @@ readProcessWithExitCode
-> [String] -- ^ any arguments
-> String -- ^ standard input
-> IO (ExitCode,String,String) -- ^ exitcode, stdout, stderr
readProcessWithExitCode cmd args input = do
let cp_opts = (proc cmd args) {
readProcessWithExitCode cmd args =
readCreateProcessWithExitCode $ proc cmd args
-- | @readCreateProcessWithExitCode@ works exactly like 'readProcessWithExitCode' except that it
-- lets you pass 'CreateProcess' giving better flexibility.
--
-- Note that @Handle@s provided for @std_in@, @std_out@, or @std_err@ via the CreateProcess
-- record will be ignored.
--
-- /Since: 1.2.3.0/
readCreateProcessWithExitCode
:: CreateProcess
-> String -- ^ standard input
-> IO (ExitCode,String,String) -- ^ exitcode, stdout, stderr
readCreateProcessWithExitCode cp input = do
let cp_opts = cp {
std_in = CreatePipe,
std_out = CreatePipe,
std_err = CreatePipe
}
withCreateProcess_ "readProcessWithExitCode" cp_opts $
withCreateProcess_ "readCreateProcessWithExitCode" cp_opts $
\(Just inh) (Just outh) (Just errh) ph -> do
out <- hGetContents outh
......
......@@ -5,7 +5,7 @@
* [Meaningful error message when exe not found on close\_fds is
True](https://ghc.haskell.org/trac/ghc/ticket/3649#comment:10)
* New function `readCreateProcess`
* New functions `readCreateProcess` and `readCreateProcessWithExitCode`
## 1.2.2.0 *Jan 2015*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment