1 {-# OPTIONS -cpp -fglasgow-exts #-}
2 -----------------------------------------------------------------------------
3 -- $Id: KludgedSystem.hs,v 1.4 2001/03/14 12:13:02 rrt 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) where
10 #include "../../includes/config.h"
12 #ifndef mingw32_TARGET_OS
14 import System (system)
16 defaultCompiler :: String
17 defaultCompiler = "gcc"
21 import qualified System
22 import System (ExitCode)
24 import Directory (removeFile)
27 system :: String -> IO ExitCode
30 let tmp = cDEFAULT_TMPDIR++"/sh"++show pid
31 writeFile tmp (cmd++"\n")
32 bracket_ (return tmp) removeFile $ System.system ("sh - "++tmp)
34 foreign import "_getpid" unsafe getProcessID :: IO Int
36 defaultCompiler :: String
37 defaultCompiler = "gcc -mno-cygwin"
39 #endif /* mingw32_TARGET_OS */