From 46b630831bda126b6f4ab723229e32c1677ae6d0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 4 Jan 2015 12:53:25 -0400 Subject: Fix build with process 1.2.1.0. --- Common.hs | 2 +- Utility/Process.hs | 25 ++++++++++++++----------- debian/changelog | 1 + 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Common.hs b/Common.hs index d64b5ad..48aa32c 100644 --- a/Common.hs +++ b/Common.hs @@ -16,7 +16,7 @@ import System.FilePath as X import System.Directory as X import System.IO as X hiding (FilePath) #ifndef mingw32_HOST_OS -import System.Posix.IO as X +import System.Posix.IO as X hiding (createPipe) #endif import System.Exit as X diff --git a/Utility/Process.hs b/Utility/Process.hs index e25618e..8fefaa5 100644 --- a/Utility/Process.hs +++ b/Utility/Process.hs @@ -1,7 +1,7 @@ {- System.Process enhancements, including additional ways of running - processes, and logging. - - - Copyright 2012 Joey Hess + - Copyright 2012 Joey Hess - - License: BSD-2-clause -} @@ -13,6 +13,7 @@ module Utility.Process ( CreateProcess(..), StdHandle(..), readProcess, + readProcess', readProcessEnv, writeReadProcessEnv, forceSuccessProcess, @@ -37,7 +38,7 @@ module Utility.Process ( ) where import qualified System.Process -import System.Process as X hiding (CreateProcess(..), createProcess, runInteractiveProcess, readProcess, readProcessWithExitCode, system, rawSystem, runInteractiveCommand, runProcess) +import qualified System.Process as X hiding (CreateProcess(..), createProcess, runInteractiveProcess, readProcess, readProcessWithExitCode, system, rawSystem, runInteractiveCommand, runProcess) import System.Process hiding (createProcess, readProcess) import System.Exit import System.IO @@ -46,7 +47,7 @@ import Control.Concurrent import qualified Control.Exception as E import Control.Monad #ifndef mingw32_HOST_OS -import System.Posix.IO +import qualified System.Posix.IO #else import Control.Applicative #endif @@ -66,17 +67,19 @@ readProcess :: FilePath -> [String] -> IO String readProcess cmd args = readProcessEnv cmd args Nothing readProcessEnv :: FilePath -> [String] -> Maybe [(String, String)] -> IO String -readProcessEnv cmd args environ = - withHandle StdoutHandle createProcessSuccess p $ \h -> do - output <- hGetContentsStrict h - hClose h - return output +readProcessEnv cmd args environ = readProcess' p where p = (proc cmd args) { std_out = CreatePipe , env = environ } +readProcess' :: CreateProcess -> IO String +readProcess' p = withHandle StdoutHandle createProcessSuccess p $ \h -> do + output <- hGetContentsStrict h + hClose h + return output + {- Runs an action to write to a process on its stdin, - returns its output, and also allows specifying the environment. -} @@ -172,9 +175,9 @@ processTranscript' cmd opts environ input = do #ifndef mingw32_HOST_OS {- This implementation interleves stdout and stderr in exactly the order - the process writes them. -} - (readf, writef) <- createPipe - readh <- fdToHandle readf - writeh <- fdToHandle writef + (readf, writef) <- System.Posix.IO.createPipe + readh <- System.Posix.IO.fdToHandle readf + writeh <- System.Posix.IO.fdToHandle writef p@(_, _, _, pid) <- createProcess $ (proc cmd opts) { std_in = if isJust input then CreatePipe else Inherit diff --git a/debian/changelog b/debian/changelog index ca2c0bd..b86f51f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ git-repair (1.20141028) UNRELEASED; urgency=medium * Debian package is now maintained by Gergely Nagy. + * Fix build with process 1.2.1.0. -- Joey Hess Tue, 11 Nov 2014 17:06:17 -0400 -- cgit v1.2.3