Commit ea47b6e6 authored by rrt's avatar rrt
Browse files

[project @ 2001-06-13 15:50:25 by rrt]

Stop using kludgedSystem; the new Windows implementation of system works
instead.
parent cac21239
{-# OPTIONS -#include "hschooks.h" #-}
-----------------------------------------------------------------------------
-- $Id: DriverFlags.hs,v 1.56 2001/05/31 11:32:25 simonmar Exp $
-- $Id: DriverFlags.hs,v 1.57 2001/06/13 15:50:25 rrt Exp $
--
-- Driver flags
--
......@@ -22,7 +22,7 @@ module DriverFlags (
import DriverState
import DriverUtil
import TmpFiles ( v_TmpDir, kludgedSystem )
import TmpFiles ( v_TmpDir )
import CmdLineOpts
import Config
import Util
......@@ -543,7 +543,7 @@ runSomething phase_name cmd
unless n $ do
-- and run it!
exit_code <- kludgedSystem cmd phase_name
exit_code <- system cmd
if exit_code /= ExitSuccess
then throwDyn (PhaseFailed phase_name exit_code)
......
-----------------------------------------------------------------------------
-- $Id: TmpFiles.hs,v 1.21 2001/05/29 17:53:59 sof Exp $
-- $Id: TmpFiles.hs,v 1.22 2001/06/13 15:50:25 rrt Exp $
--
-- Temporary file management
--
......@@ -15,8 +15,7 @@ module TmpFiles (
newTempName, -- :: Suffix -> IO FilePath
addFilesToClean, -- :: [FilePath] -> IO ()
removeTmpFiles, -- :: Int -> [FilePath] -> IO ()
v_TmpDir,
kludgedSystem
v_TmpDir
) where
-- main
......@@ -88,37 +87,12 @@ removeTmpFiles verb fs = do
(do when verbose (hPutStrLn stderr ("Removing: " ++ f))
if '*' `elem` f
#if defined(mingw32_TARGET_OS) && defined(MINIMAL_UNIX_DEPS)
then kludgedSystem (unwords [cRM, dosifyPath f]) "Cleaning temp files" >> return ()
then system (unwords [cRM, dosifyPath f]) >> return ()
#else
then kludgedSystem (unwords [cRM, f]) "Cleaning temp files" >> return ()
then system (unwords [cRM, f]) >> return ()
#endif
else removeFile f)
`catchAllIO`
(\_ -> when verbose (hPutStrLn stderr
("Warning: can't remove tmp file " ++ f)))
mapM_ blowAway fs
-- system that works feasibly under Windows (i.e. passes the command line to sh,
-- because system() under Windows doesn't look at SHELL, and always uses CMD.EXE)
kludgedSystem cmd phase_name
= do
#if !defined(mingw32_TARGET_OS) || defined(MINIMAL_UNIX_DEPS)
-- in the case where we do want to use an MSDOS command shell, we assume
-- that files and paths have been converted to a form that's
-- understandable to the command we're invoking.
exit_code <- system cmd `catchAllIO`
(\_ -> throwDyn (PhaseFailed phase_name (ExitFailure 1)))
#else
pid <- myGetProcessID
tmp_dir <- readIORef v_TmpDir
let tmp = tmp_dir++"/sh"++show pid
h <- openFile tmp WriteMode
hPutStrLn h cmd
hClose h
exit_code <- system ("sh - " ++ tmp) `catchAllIO`
(\_ -> removeFile tmp >>
throwDyn (PhaseFailed phase_name (ExitFailure 1)))
removeFile tmp
#endif
return exit_code
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment