avoiding depending on latest version of process except on Windows
This commit is contained in:
parent
e05acd20a5
commit
76c63a4a66
2 changed files with 13 additions and 2 deletions
|
@ -5,6 +5,8 @@
|
||||||
- Licensed under the GNU GPL version 3 or higher.
|
- Licensed under the GNU GPL version 3 or higher.
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
{-# LANGUAGE CPP #-}
|
||||||
|
|
||||||
module Annex.Multicast where
|
module Annex.Multicast where
|
||||||
|
|
||||||
import Config.Files
|
import Config.Files
|
||||||
|
@ -14,6 +16,9 @@ import Utility.PartialPrelude
|
||||||
import System.Process
|
import System.Process
|
||||||
import System.IO
|
import System.IO
|
||||||
import GHC.IO.Handle.FD
|
import GHC.IO.Handle.FD
|
||||||
|
#if ! MIN_VERSION_process(1,4,2)
|
||||||
|
import System.Posix.IO (handleToFd)
|
||||||
|
#endif
|
||||||
|
|
||||||
multicastReceiveEnv :: String
|
multicastReceiveEnv :: String
|
||||||
multicastReceiveEnv = "GIT_ANNEX_MULTICAST_RECEIVE"
|
multicastReceiveEnv = "GIT_ANNEX_MULTICAST_RECEIVE"
|
||||||
|
@ -21,8 +26,14 @@ multicastReceiveEnv = "GIT_ANNEX_MULTICAST_RECEIVE"
|
||||||
multicastCallbackEnv :: IO (FilePath, [(String, String)], Handle)
|
multicastCallbackEnv :: IO (FilePath, [(String, String)], Handle)
|
||||||
multicastCallbackEnv = do
|
multicastCallbackEnv = do
|
||||||
gitannex <- readProgramFile
|
gitannex <- readProgramFile
|
||||||
|
#if MIN_VERSION_process(1,4,2)
|
||||||
|
-- This will even work on Windows
|
||||||
(rfd, wfd) <- createPipeFd
|
(rfd, wfd) <- createPipeFd
|
||||||
rh <- fdToHandle rfd
|
rh <- fdToHandle rfd
|
||||||
|
#else
|
||||||
|
(rh, wh) <- createPipe
|
||||||
|
wfd <- handleToFd wh
|
||||||
|
#endif
|
||||||
environ <- addEntry multicastReceiveEnv (show wfd) <$> getEnvironment
|
environ <- addEntry multicastReceiveEnv (show wfd) <$> getEnvironment
|
||||||
return (gitannex, environ, rh)
|
return (gitannex, environ, rh)
|
||||||
|
|
||||||
|
|
|
@ -319,7 +319,7 @@ Executable git-annex
|
||||||
stm (>= 2.3),
|
stm (>= 2.3),
|
||||||
mtl (>= 2),
|
mtl (>= 2),
|
||||||
uuid (>= 1.2.6),
|
uuid (>= 1.2.6),
|
||||||
process (>= 1.4.2.0),
|
process,
|
||||||
data-default,
|
data-default,
|
||||||
case-insensitive,
|
case-insensitive,
|
||||||
random,
|
random,
|
||||||
|
@ -384,7 +384,7 @@ Executable git-annex
|
||||||
|
|
||||||
if (os(windows))
|
if (os(windows))
|
||||||
Build-Depends: Win32, Win32-extras, unix-compat (>= 0.4.1.3), setenv,
|
Build-Depends: Win32, Win32-extras, unix-compat (>= 0.4.1.3), setenv,
|
||||||
process (>= 1.3.0.0)
|
process (>= 1.4.2.0)
|
||||||
else
|
else
|
||||||
Build-Depends: unix
|
Build-Depends: unix
|
||||||
if impl(ghc <= 7.6.3)
|
if impl(ghc <= 7.6.3)
|
||||||
|
|
Loading…
Reference in a new issue