diff options
Diffstat (limited to 'utils/runghc')
-rw-r--r-- | utils/runghc/Main.hs | 24 | ||||
-rw-r--r-- | utils/runghc/runghc.cabal.in | 3 |
2 files changed, 21 insertions, 6 deletions
diff --git a/utils/runghc/Main.hs b/utils/runghc/Main.hs index 001d902f80..bcf77e7b8a 100644 --- a/utils/runghc/Main.hs +++ b/utils/runghc/Main.hs @@ -24,11 +24,13 @@ import System.Environment import System.Exit import System.FilePath import System.IO -import System.Process #if defined(mingw32_HOST_OS) +import System.Process (runProcess) import Foreign import Foreign.C.String +#else +import System.Posix.Process (executeFile) #endif #if defined(mingw32_HOST_OS) @@ -141,11 +143,21 @@ doIt ghc ghc_args rest = do else [] c1 = ":set prog " ++ show filename c2 = ":main " ++ show prog_args - res <- rawSystem ghc (["-ignore-dot-ghci"] ++ - xflag ++ - ghc_args ++ - [ "-e", c1, "-e", c2, filename]) - exitWith res + + let cmd = ghc + args = ["-ignore-dot-ghci"] ++ + xflag ++ + ghc_args ++ + [ "-e", c1, "-e", c2, filename] + + +#if defined(mingw32_HOST_OS) + rawSystem cmd args >>= exitWith +#else + -- Passing False to avoid searching the PATH, since the cmd should + -- always be an absolute path to the ghc executable. + executeFile cmd False args Nothing +#endif getGhcArgs :: [String] -> ([String], [String]) getGhcArgs args diff --git a/utils/runghc/runghc.cabal.in b/utils/runghc/runghc.cabal.in index efef5ec4db..2253292cf0 100644 --- a/utils/runghc/runghc.cabal.in +++ b/utils/runghc/runghc.cabal.in @@ -30,3 +30,6 @@ Executable runghc directory >= 1 && < 1.3, process >= 1 && < 1.5, filepath + + if !os(windows) + build-depends: unix
\ No newline at end of file |