From 3434b389c4b54ee3a27b6148cb061f5b173d746f Mon Sep 17 00:00:00 2001 From: Mikhail Glushenkov Date: Sat, 12 Oct 2013 20:10:21 +0200 Subject: [PATCH] Unbreak the build on Windows. Broken by #1535. --- Cabal/Distribution/Simple/Utils.hs | 36 +++++++++++++++++------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/Cabal/Distribution/Simple/Utils.hs b/Cabal/Distribution/Simple/Utils.hs index 7fd9a07f704..dfbb83083c2 100644 --- a/Cabal/Distribution/Simple/Utils.hs +++ b/Cabal/Distribution/Simple/Utils.hs @@ -195,20 +195,24 @@ import Distribution.Version (Version(..)) import Control.Exception (IOException, evaluate, throwIO) -import System.Process (rawSystem, CreateProcess(..)) +import System.Process (rawSystem) +import qualified System.Process as Process (CreateProcess(..)) import Control.Concurrent (forkIO) -import System.Process (runInteractiveProcess, waitForProcess, proc, StdStream(..)) +import System.Process (runInteractiveProcess, waitForProcess, proc, + StdStream(..)) #if __GLASGOW_HASKELL__ >= 702 import System.Process (showCommandForUser) #endif -#if !mingw32_HOST_OS -import System.Posix.Signals ( installHandler, sigINT, sigQUIT, Handler(..) ) +#ifndef mingw32_HOST_OS +import System.Posix.Signals (defaultSignal, installHandler, sigINT, sigQUIT, + Handler(..)) +import System.Process.Internals (runGenProcess_) +#else +import System.Process (createProcess) #endif -import System.Process.Internals ( runGenProcess_, defaultSignal ) - import Distribution.Compat.CopyFile ( copyFile, copyOrdinaryFile, copyExecutableFile , setFileOrdinary, setFileExecutable, setDirOrdinary ) @@ -392,7 +396,7 @@ printRawCommandAndArgsAndEnv verbosity path args env -- The reason we need it is that runProcess doesn't handle ^C in the same -- way that rawSystem handles it, but rawSystem doesn't allow us to pass -- an environment. -syncProcess :: String -> CreateProcess -> IO ExitCode +syncProcess :: String -> Process.CreateProcess -> IO ExitCode #if mingw32_HOST_OS syncProcess _fun c = do (_,_,_,p) <- createProcess c @@ -439,10 +443,11 @@ rawSystemExitWithEnv :: Verbosity -> [String] -> [(String, String)] -> IO () -rawSystemExitWithEnv verbosity path args env' = do - printRawCommandAndArgsAndEnv verbosity path args env' +rawSystemExitWithEnv verbosity path args env = do + printRawCommandAndArgsAndEnv verbosity path args env hFlush stdout - exitcode <- syncProcess "rawSystemExitWithEnv" (proc path args) { env = Just env' } + exitcode <- syncProcess "rawSystemExitWithEnv" (proc path args) + { Process.env = Just env } unless (exitcode == ExitSuccess) $ do debug verbosity $ path ++ " returned " ++ show exitcode exitWith exitcode @@ -461,11 +466,12 @@ rawSystemIOWithEnv verbosity path args mcwd menv inp out err = do maybe (printRawCommandAndArgs verbosity path args) (printRawCommandAndArgsAndEnv verbosity path args) menv hFlush stdout - exitcode <- syncProcess "rawSystemIOWithEnv" (proc path args) { cwd = mcwd - , env = menv - , std_in = mbToStd inp - , std_out = mbToStd out - , std_err = mbToStd err } + exitcode <- syncProcess "rawSystemIOWithEnv" (proc path args) + { Process.cwd = mcwd + , Process.env = menv + , Process.std_in = mbToStd inp + , Process.std_out = mbToStd out + , Process.std_err = mbToStd err } unless (exitcode == ExitSuccess) $ do debug verbosity $ path ++ " returned " ++ show exitcode return exitcode