summaryrefslogtreecommitdiff
path: root/Utility/Process.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-07-19 00:57:40 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-07-19 00:57:40 -0400
commit9fc94d780b7331da13597208ba37a9f4d4ab6531 (patch)
tree6572c007ac50a8086a6cdadf2c80de1fc4cc24ea /Utility/Process.hs
parent1db7d27a451f552dbae8760e83c73b90da8114d5 (diff)
better readProcess
Diffstat (limited to 'Utility/Process.hs')
-rw-r--r--Utility/Process.hs18
1 files changed, 15 insertions, 3 deletions
diff --git a/Utility/Process.hs b/Utility/Process.hs
index 9b57c3b7a..3b293df4f 100644
--- a/Utility/Process.hs
+++ b/Utility/Process.hs
@@ -22,6 +22,7 @@ module Utility.Process (
withBothHandles,
createProcess,
runInteractiveProcess,
+ writeReadProcess,
readProcess
) where
@@ -192,11 +193,22 @@ runInteractiveProcess f args c e = do
}
System.Process.runInteractiveProcess f args c e
-readProcess
+{- I think this is a more descriptive name than System.Process.readProcess. -}
+writeReadProcess
:: FilePath
-> [String]
-> String
-> IO String
-readProcess f args input = do
- debugProcess $ (proc f args) { std_out = CreatePipe }
+writeReadProcess f args input = do
+ debugProcess $ (proc f args) { std_out = CreatePipe, std_in = CreatePipe }
System.Process.readProcess f args input
+
+{- Normally, when reading from a process, it does not need to be fed any
+ - input. -}
+readProcess
+ :: FilePath
+ -> [String]
+ -> IO String
+readProcess f args = do
+ debugProcess $ (proc f args) { std_out = CreatePipe }
+ System.Process.readProcess f args []