[commit: packages/process] master: readCreateProcessWithExitCode (d0a62be)
git at git.haskell.org
git at git.haskell.org
Thu Mar 19 11:38:20 UTC 2015
Repository : ssh://git@git.haskell.org/process
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/d0a62be4d7d5867676da285540c21e2e2d8cd0c7/process
>---------------------------------------------------------------
commit d0a62be4d7d5867676da285540c21e2e2d8cd0c7
Author: Michael Snoyman <michael at snoyman.com>
Date: Sun Mar 1 17:07:24 2015 +0200
readCreateProcessWithExitCode
>---------------------------------------------------------------
d0a62be4d7d5867676da285540c21e2e2d8cd0c7
System/Process.hsc | 21 ++++++++++++++++++---
changelog.md | 2 +-
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/System/Process.hsc b/System/Process.hsc
index c73326a..32ad6af 100644
--- a/System/Process.hsc
+++ b/System/Process.hsc
@@ -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 at 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
diff --git a/changelog.md b/changelog.md
index e5a7faa..7d27d6c 100644
--- a/changelog.md
+++ b/changelog.md
@@ -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*
More information about the ghc-commits
mailing list