Commit a355262a authored by simonmar's avatar simonmar
Browse files

[project @ 2005-04-27 08:25:46 by simonmar]

newTempName: instead of bumping the processId until we find a name
that isn't used, add an integer suffix to the processId.  This should
prevent temp-file conflicts that appear to have been affecting our
nightly builds and occasionally make -j.

The right way to allocate a temporary file is to create it straight
away, but I'm not sure of the implications of passing existing
temporary files to the various sub-processes that GHC executes, hence
this fix instead.
parent 68ded3ed
......@@ -544,12 +544,12 @@ cleanTempFilesExcept dflags dont_delete
newTempName :: DynFlags -> Suffix -> IO FilePath
newTempName DynFlags{tmpDir=tmp_dir} extn
= do x <- getProcessID
findTempName tmp_dir x
findTempName (tmp_dir ++ "/ghc" ++ show x ++ "_") 0
findTempName tmp_dir x
= do let filename = tmp_dir ++ "/ghc" ++ show x ++ '.':extn
findTempName prefix x
= do let filename = prefix ++ show x ++ '.':extn
b <- doesFileExist filename
if b then findTempName tmp_dir (x+1)
if b then findTempName prefix (x+1)
else do consIORef v_FilesToClean filename -- clean it up later
return filename
Supports Markdown
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