From d157569b69805f1ba1353223f991ba2b036cc0b1 Mon Sep 17 00:00:00 2001 From: rrt Date: Mon, 25 Jun 2001 09:34:11 +0000 Subject: [PATCH] [project @ 2001-06-25 09:34:11 by rrt] Remove hacked-in definition of system for mingwin; instead we now just link against the new version of systemCmd from lib/std/cbits/system.c. --- ghc/compiler/main/SysTools.lhs | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/ghc/compiler/main/SysTools.lhs b/ghc/compiler/main/SysTools.lhs index fb9f564..50fa355 100644 --- a/ghc/compiler/main/SysTools.lhs +++ b/ghc/compiler/main/SysTools.lhs @@ -55,12 +55,7 @@ import IO ( hPutStr, hPutChar, hPutStrLn, hFlush, stderr ) import Directory ( doesFileExist, removeFile ) import IOExts ( IORef, readIORef, writeIORef ) import Monad ( when, unless ) -#if defined(mingw32_TARGET_OS) && __GLASGOW_HASKELL__ < 501 -import qualified System -#else -import System ( system ) -#endif -import System ( ExitCode(..), exitWith ) +import System ( system, ExitCode(..), exitWith ) #include "../includes/config.h" @@ -654,35 +649,3 @@ getProcessID = Posix.getProcessID getExecDir :: IO (Maybe String) = do return Nothing #endif \end{code} - -%************************************************************************ -%* * -\subsection{System} -%* * -%************************************************************************ - -In GHC prior to 5.01 (or so), on Windows, the implementation -of "system" in the library System.system does not work for very -long command lines. But GHC may need to make a system call with -a very long command line, notably when it links itself during -bootstrapping. - -Solution: import the new definition (which involves compiling up -lib/std/cbits/system.c) - -ToDo: remove when compiling with GHC < 5 is not relevant any more - -\begin{code} -#if defined(mingw32_TARGET_OS) && __GLASGOW_HASKELL__ > 500 --- copied from lib/std/System.lhs -system cmd = - withUnsafeCString cmd $ \s -> do - status <- throwErrnoIfMinus1 "system" (primSystem s) - case status of - 0 -> return ExitSuccess - n -> return (ExitFailure n) -system "" = ioException (IOError Nothing InvalidArgument "system" "null command" Nothing) - -foreign import ccall "systemCmd" unsafe primSystem :: UnsafeCString -> IO Int -#endif -\end{code} -- 1.7.10.4