Commit 01591a28 authored by sof's avatar sof
Browse files

[project @ 2003-02-07 22:14:32 by sof]

Rip out rawSystem impl -- it only happened to work by accident.

Simpler to just assume that SystemExts supplies it instead, which it
has for a number of versions now.
parent e1618c1f
...@@ -107,17 +107,7 @@ import CString ( CString, peekCString ) ...@@ -107,17 +107,7 @@ import CString ( CString, peekCString )
#if __GLASGOW_HASKELL__ > 504 #if __GLASGOW_HASKELL__ > 504
import System.Cmd ( rawSystem ) import System.Cmd ( rawSystem )
#else #else
import SystemExts ( rawSystem )
-- For Win32 and GHC <= 504
-- rawSystem is defined in this module
-- We just need an import
#if __GLASGOW_HASKELL__ < 503
import PrelIOBase( ioException, IOException(..), IOErrorType(InvalidArgument) )
#else
import GHC.IOBase( ioException, IOException(..), IOErrorType(InvalidArgument) )
#endif
import CError ( throwErrnoIfMinus1 )
import CString ( withCString )
#endif #endif
#else /* Not Win32 */ #else /* Not Win32 */
...@@ -428,7 +418,7 @@ initSysTools minusB_args ...@@ -428,7 +418,7 @@ initSysTools minusB_args
} }
#if defined(mingw32_HOST_OS) #if defined(mingw32_HOST_OS)
foreign import stdcall "GetTempPathA" unsafe getTempPath :: Int -> CString -> IO Int32 foreign import stdcall unsafe "GetTempPathA" getTempPath :: Int -> CString -> IO Int32
#endif #endif
\end{code} \end{code}
...@@ -853,14 +843,14 @@ getExecDir = do let len = (2048::Int) -- plenty, PATH_MAX is 512 under Win32. ...@@ -853,14 +843,14 @@ getExecDir = do let len = (2048::Int) -- plenty, PATH_MAX is 512 under Win32.
return (Just (reverse (dropList "/bin/ghc.exe" (reverse (unDosifyPath s))))) return (Just (reverse (dropList "/bin/ghc.exe" (reverse (unDosifyPath s)))))
foreign import stdcall "GetModuleFileNameA" unsafe foreign import stdcall unsafe "GetModuleFileNameA"
getModuleFileName :: Ptr () -> CString -> Int -> IO Int32 getModuleFileName :: Ptr () -> CString -> Int -> IO Int32
#else #else
getExecDir :: IO (Maybe String) = do return Nothing getExecDir :: IO (Maybe String) = do return Nothing
#endif #endif
#ifdef mingw32_HOST_OS #ifdef mingw32_HOST_OS
foreign import "_getpid" unsafe getProcessID :: IO Int -- relies on Int == Int32 on Windows foreign import ccall unsafe "_getpid" getProcessID :: IO Int -- relies on Int == Int32 on Windows
#elif __GLASGOW_HASKELL__ > 504 #elif __GLASGOW_HASKELL__ > 504
getProcessID :: IO Int getProcessID :: IO Int
getProcessID = GHC.Posix.c_getpid >>= return . fromIntegral getProcessID = GHC.Posix.c_getpid >>= return . fromIntegral
...@@ -878,25 +868,3 @@ quote s = s ...@@ -878,25 +868,3 @@ quote s = s
#endif #endif
\end{code} \end{code}
This next blob is in System.Cmd after 5.04, but until then it needs
to be here (for Win32 only).
\begin{code}
#if defined(mingw32_HOST_OS)
#if __GLASGOW_HASKELL__ <= 504
rawSystem :: String -> IO ExitCode
rawSystem "" = ioException (IOError Nothing InvalidArgument "rawSystem" "null command" Nothing)
rawSystem cmd =
withCString cmd $ \s -> do
status <- throwErrnoIfMinus1 "rawSystem" (primRawSystem s)
case status of
0 -> return ExitSuccess
n -> return (ExitFailure n)
foreign import ccall "rawSystemCmd" unsafe primRawSystem :: CString -> IO Int
#endif
#endif
\end{code}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment