aboutsummaryrefslogtreecommitdiff
path: root/Utility/Process.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-10-28 13:51:14 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-10-28 13:51:14 -0400
commitef8c4afd050cc729819b97a1f8864f613b6debbd (patch)
treef1e2aa10bdc7efe682913af317fcf3bd1c05fec6 /Utility/Process.hs
parent9600c62cef11809a32a86cc48824a647f87fcc44 (diff)
rsync special remote: Include annex-rsync-options when running rsync to test a key's presence.
Also, use the new withQuietOutput function to avoid running the shell to /dev/null stderr in two other places.
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.