From 8a322570e84779f83613b1e3502c0149bf9f8796 Mon Sep 17 00:00:00 2001 From: sewardj Date: Mon, 11 Dec 2000 14:42:21 +0000 Subject: [PATCH] [project @ 2000-12-11 14:42:21 by sewardj] Remove circular dependencies created by kludgedSystem. --- ghc/compiler/main/DriverUtil.hs | 10 ++++++---- ghc/compiler/main/TmpFiles.hs | 4 +--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ghc/compiler/main/DriverUtil.hs b/ghc/compiler/main/DriverUtil.hs index 4301d86..31808aa 100644 --- a/ghc/compiler/main/DriverUtil.hs +++ b/ghc/compiler/main/DriverUtil.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: DriverUtil.hs,v 1.12 2000/12/11 12:30:58 rrt Exp $ +-- $Id: DriverUtil.hs,v 1.13 2000/12/11 14:42:21 sewardj Exp $ -- -- Utils for the driver -- @@ -13,7 +13,6 @@ module DriverUtil where #include "HsVersions.h" import Util -import TmpFiles ( newTempName ) import IOExts import Exception @@ -185,6 +184,7 @@ newdir dir s = dir ++ '/':drop_longest_prefix s '/' remove_spaces :: String -> String remove_spaces = reverse . dropWhile isSpace . reverse . dropWhile isSpace + -- 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 @@ -193,12 +193,14 @@ kludgedSystem cmd phase_name exit_code <- system cmd `catchAllIO` (\_ -> throwDyn (PhaseFailed phase_name (ExitFailure 1))) #else - tmp <- newTempName "sh" + pid <- myGetProcessID + let tmp = "/tmp/sh" ++ show pid h <- openFile tmp WriteMode hPutStrLn h cmd hClose h exit_code <- system ("sh - " ++ tmp) `catchAllIO` - (\_ -> throwDyn (PhaseFailed phase_name (ExitFailure 1))) + (\_ -> removeFile tmp >> + throwDyn (PhaseFailed phase_name (ExitFailure 1))) removeFile tmp #endif return exit_code diff --git a/ghc/compiler/main/TmpFiles.hs b/ghc/compiler/main/TmpFiles.hs index 872719e..823b79c 100644 --- a/ghc/compiler/main/TmpFiles.hs +++ b/ghc/compiler/main/TmpFiles.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: TmpFiles.hs,v 1.12 2000/12/11 12:30:58 rrt Exp $ +-- $Id: TmpFiles.hs,v 1.13 2000/12/11 14:42:21 sewardj Exp $ -- -- Temporary file management -- @@ -19,7 +19,6 @@ module TmpFiles ( -- main import Config import Util -import DriverUtil ( kludgedSystem ) -- hslibs import Exception @@ -81,4 +80,3 @@ add :: IORef [a] -> a -> IO () add var x = do xs <- readIORef var writeIORef var (x:xs) - -- 1.7.10.4