summaryrefslogtreecommitdiff
path: root/Utility/Process.hs
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2014-01-13 18:10:21 -0400
committerJoey Hess <joey@kitenet.net>2014-01-13 18:10:21 -0400
commit14ce1badd4210ebb2660e0fb22ba4ff7f2986dee (patch)
treea0eb1548d7d879631cef51266e8f2ee65fa7a66f /Utility/Process.hs
parentdd1d8e69d4c190c7bb60d5187f7a889c6fea0d62 (diff)
downloadgit-repair-14ce1badd4210ebb2660e0fb22ba4ff7f2986dee.tar.gz
merge from git-annex
Diffstat (limited to 'Utility/Process.hs')
-rw-r--r--Utility/Process.hs12
1 files changed, 5 insertions, 7 deletions
diff --git a/Utility/Process.hs b/Utility/Process.hs
index 03cbe95..1945e4b 100644
--- a/Utility/Process.hs
+++ b/Utility/Process.hs
@@ -26,12 +26,12 @@ module Utility.Process (
withHandle,
withBothHandles,
withQuietOutput,
- withNullHandle,
createProcess,
startInteractiveProcess,
stdinHandle,
stdoutHandle,
stderrHandle,
+ devNull,
) where
import qualified System.Process
@@ -280,20 +280,18 @@ withQuietOutput
:: CreateProcessRunner
-> CreateProcess
-> IO ()
-withQuietOutput creator p = withNullHandle $ \nullh -> do
+withQuietOutput creator p = withFile devNull WriteMode $ \nullh -> do
let p' = p
{ std_out = UseHandle nullh
, std_err = UseHandle nullh
}
creator p' $ const $ return ()
-withNullHandle :: (Handle -> IO a) -> IO a
-withNullHandle = withFile devnull WriteMode
- where
+devNull :: FilePath
#ifndef mingw32_HOST_OS
- devnull = "/dev/null"
+devNull = "/dev/null"
#else
- devnull = "NUL"
+devNull = "NUL"
#endif
{- Extract a desired handle from createProcess's tuple.