diff options
author | Joey Hess <joey@kitenet.net> | 2013-12-10 23:19:18 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-12-10 23:19:18 -0400 |
commit | f864a68220a0d77b5b6a5c3f4f25743e8e76aae0 (patch) | |
tree | 3e9006aa151b5c8e2ba8562aeefbd6db23cde69f /Utility/Process.hs | |
parent | 180115645b86580d9077e95504b029152de15fa2 (diff) |
port transferkeys to windows; make stopping in progress transfers work too (probably)
transferkeys had used special FDs for communication, but that would be
quite annoying to do in Windows.
Instead, use stdin and stdout. But, to avoid commands like rsync stomping
on them and messing up the communications channel, they're duplicated to a
different handle; stdin is replaced with a null handle, and stdout is
replaced with a copy of stderr. This should all work in windows too.
Stopping in progress transfers may work on windows.. if the types unify
anyway. ;) May need some more porting.
Diffstat (limited to 'Utility/Process.hs')
-rw-r--r-- | Utility/Process.hs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Utility/Process.hs b/Utility/Process.hs index 03cbe9558..1945e4b9d 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. |