1 {-# OPTIONS -cpp -fglasgow-exts #-}
2 -----------------------------------------------------------------------------
3 -- $Id: KludgedSystem.hs,v 1.8 2001/07/04 09:18:38 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"
14 #ifndef mingw32_TARGET_OS
16 import System (system)
18 defaultCompiler :: String
19 defaultCompiler = cGCC
24 import qualified System
25 import System (ExitCode)
27 import Directory (removeFile)
29 system :: String -> IO ExitCode
32 let tmp = cDEFAULT_TMPDIR++"/sh"++show pid
33 writeFile tmp (cmd++"\n")
34 bracket_ (return tmp) removeFile $ System.system ("sh - "++tmp)
36 foreign import "_getpid" unsafe getProcessID :: IO Int
38 defaultCompiler :: String
39 defaultCompiler = cGCC ++ " -mno-cygwin"
40 progNameSuffix = ".exe"
42 #endif /* mingw32_TARGET_OS */