1 {-# OPTIONS -cpp -fglasgow-exts #-}
2 -----------------------------------------------------------------------------
3 -- $Id: KludgedSystem.hs,v 1.3 2001/03/13 17:46:56 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 tmp_dir <- readIORef v_TmpDir
31 let tmp = tmp_dir++"/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 = "gcc -mno-cygwin"
40 #endif /* mingw32_TARGET_OS */