summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-04-10 12:14:24 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-04-10 12:14:24 -0400
commitdd6a20ac7111f0e7c6c0222511d25fdce108bb6b (patch)
tree8ddf4b2d1393d194c7c27a04aa06d51ae886f246 /Annex
parent129e40d3d2202710f3b55d426901d50063e4aff0 (diff)
avoiding depending on latest version of process except on Windows
Diffstat (limited to 'Annex')
-rw-r--r--Annex/Multicast.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/Annex/Multicast.hs b/Annex/Multicast.hs
index 16aa1bd33..67d8ad7ad 100644
--- a/Annex/Multicast.hs
+++ b/Annex/Multicast.hs
@@ -5,6 +5,8 @@
- Licensed under the GNU GPL version 3 or higher.
-}
+{-# LANGUAGE CPP #-}
+
module Annex.Multicast where
import Config.Files
@@ -14,6 +16,9 @@ import Utility.PartialPrelude
import System.Process
import System.IO
import GHC.IO.Handle.FD
+#if ! MIN_VERSION_process(1,4,2)
+import System.Posix.IO (handleToFd)
+#endif
multicastReceiveEnv :: String
multicastReceiveEnv = "GIT_ANNEX_MULTICAST_RECEIVE"
@@ -21,8 +26,14 @@ multicastReceiveEnv = "GIT_ANNEX_MULTICAST_RECEIVE"
multicastCallbackEnv :: IO (FilePath, [(String, String)], Handle)
multicastCallbackEnv = do
gitannex <- readProgramFile
+#if MIN_VERSION_process(1,4,2)
+ -- This will even work on Windows
(rfd, wfd) <- createPipeFd
rh <- fdToHandle rfd
+#else
+ (rh, wh) <- createPipe
+ wfd <- handleToFd wh
+#endif
environ <- addEntry multicastReceiveEnv (show wfd) <$> getEnvironment
return (gitannex, environ, rh)