1 {-# OPTIONS -cpp -fglasgow-exts #-}
2 -----------------------------------------------------------------------------
3 -- $Id: KludgedSystem.hs,v 1.7 2001/07/03 16:57:03 sewardj Exp $
5 -- system that works feasibly under Windows (i.e. passes the command line to sh,
6 -- because system() under Windows doesn't look at SHELL, and always uses CMD.EXE)
8 module KludgedSystem (system, defaultCompiler, progNameSuffix) where
10 #include "../../includes/config.h"
12 #ifndef mingw32_TARGET_OS
14 import System (system)
16 defaultCompiler :: String
17 defaultCompiler = cGCC
22 import qualified System
23 import System (ExitCode)
25 import Directory (removeFile)
28 system :: String -> IO ExitCode
31 let tmp = cDEFAULT_TMPDIR++"/sh"++show pid
32 writeFile tmp (cmd++"\n")
33 bracket_ (return tmp) removeFile $ System.system ("sh - "++tmp)
35 foreign import "_getpid" unsafe getProcessID :: IO Int
37 defaultCompiler :: String
38 defaultCompiler = cGCC ++ " -mno-cygwin"
39 progNameSuffix = ".exe"
41 #endif /* mingw32_TARGET_OS */