summaryrefslogtreecommitdiff
path: root/Utility/Process.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Utility/Process.hs')
-rw-r--r--Utility/Process.hs14
1 files changed, 14 insertions, 0 deletions
diff --git a/Utility/Process.hs b/Utility/Process.hs
index 613dd8b0f..0ef043424 100644
--- a/Utility/Process.hs
+++ b/Utility/Process.hs
@@ -23,6 +23,7 @@ module Utility.Process (
createBackgroundProcess,
withHandle,
withBothHandles,
+ withQuietOutput,
createProcess,
runInteractiveProcess,
stdinHandle,
@@ -185,6 +186,19 @@ withBothHandles creator p a = creator p' $ a . bothHandles
, std_err = Inherit
}
+{- Forces the CreateProcessRunner to run quietly;
+ - both stdout and stderr are discarded. -}
+withQuietOutput
+ :: CreateProcessRunner
+ -> CreateProcess
+ -> IO ()
+withQuietOutput creator p = withFile "/dev/null" WriteMode $ \devnull -> do
+ let p' = p
+ { std_out = UseHandle devnull
+ , std_err = UseHandle devnull
+ }
+ creator p' $ const $ return ()
+
{- Extract a desired handle from createProcess's tuple.
- These partial functions are safe as long as createProcess is run
- with appropriate parameters to set up the desired handle.