diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-10-27 23:50:27 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-10-27 23:50:27 -0400 |
| commit | 261d008d41e6656ce4ceafb8c0f0630d5795944a (patch) | |
| tree | 5b1b7a4dfc17951e9cd5eeed7f71b1645c252218 /src | |
| parent | 51b397d0415e1efe1df412842ccb76d702140f50 (diff) | |
merge from git-annex
Diffstat (limited to 'src')
| -rw-r--r-- | src/Utility/Process.hs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/Utility/Process.hs b/src/Utility/Process.hs index c4882a01..cc113867 100644 --- a/src/Utility/Process.hs +++ b/src/Utility/Process.hs @@ -172,22 +172,21 @@ createBackgroundProcess p a = a =<< createProcess p -- returns a transcript combining its stdout and stderr, and -- whether it succeeded or failed. processTranscript :: String -> [String] -> (Maybe String) -> IO (String, Bool) -processTranscript cmd opts = processTranscript' cmd opts Nothing +processTranscript = processTranscript' id -processTranscript' :: String -> [String] -> Maybe [(String, String)] -> (Maybe String) -> IO (String, Bool) -processTranscript' cmd opts environ input = do +processTranscript' :: (CreateProcess -> CreateProcess) -> String -> [String] -> Maybe String -> IO (String, Bool) +processTranscript' modproc cmd opts input = do #ifndef mingw32_HOST_OS {- This implementation interleves stdout and stderr in exactly the order - the process writes them. -} (readf, writef) <- System.Posix.IO.createPipe readh <- System.Posix.IO.fdToHandle readf writeh <- System.Posix.IO.fdToHandle writef - p@(_, _, _, pid) <- createProcess $ + p@(_, _, _, pid) <- createProcess $ modproc $ (proc cmd opts) { std_in = if isJust input then CreatePipe else Inherit , std_out = UseHandle writeh , std_err = UseHandle writeh - , env = environ } hClose writeh @@ -199,12 +198,11 @@ processTranscript' cmd opts environ input = do return (transcript, ok) #else {- This implementation for Windows puts stderr after stdout. -} - p@(_, _, _, pid) <- createProcess $ + p@(_, _, _, pid) <- createProcess $ modproc $ (proc cmd opts) { std_in = if isJust input then CreatePipe else Inherit , std_out = CreatePipe , std_err = CreatePipe - , env = environ } getout <- mkreader (stdoutHandle p) |
