summaryrefslogtreecommitdiff
path: root/Utility
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-06-17 21:26:06 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-06-17 21:26:06 -0400
commit26be844f54c8941bab7b0a7eeb7c5ed45a010f6d (patch)
tree2e0723cb7cc6df2f5c97818478dc864a251dad7a /Utility
parent278d5fea4caef3c159cb7525f2aa4399baea95dd (diff)
make withQuietOutput work on Windows
Diffstat (limited to 'Utility')
-rw-r--r--Utility/Process.hs12
1 files changed, 9 insertions, 3 deletions
diff --git a/Utility/Process.hs b/Utility/Process.hs
index ecd42a98e..a98d04df5 100644
--- a/Utility/Process.hs
+++ b/Utility/Process.hs
@@ -241,12 +241,18 @@ withQuietOutput
:: CreateProcessRunner
-> CreateProcess
-> IO ()
-withQuietOutput creator p = withFile "/dev/null" WriteMode $ \devnull -> do
+withQuietOutput creator p = withFile devnull WriteMode $ \nullh -> do
let p' = p
- { std_out = UseHandle devnull
- , std_err = UseHandle devnull
+ { std_out = UseHandle nullh
+ , std_err = UseHandle nullh
}
creator p' $ const $ return ()
+ where
+#ifndef mingw32_HOST_OS
+ devnull = "/dev/null"
+#else
+ devnull = "NUL"
+#endif
{- Extract a desired handle from createProcess's tuple.
- These partial functions are safe as long as createProcess is run