diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2021-05-20 20:10:26 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-05-21 06:24:44 -0400 |
commit | 6eed426bf24fe4ddc4c4802ff44b949e74f9d7ee (patch) | |
tree | c6517e8aa2df1f780bb5f64e75921ede319ba9b2 /compiler/GHC/Driver/MakeFile.hs | |
parent | f5f741673079ea58d204acea8dd363dd300b157e (diff) | |
download | haskell-6eed426bf24fe4ddc4c4802ff44b949e74f9d7ee.tar.gz |
SysTools: make file copy more efficient
Diffstat (limited to 'compiler/GHC/Driver/MakeFile.hs')
-rw-r--r-- | compiler/GHC/Driver/MakeFile.hs | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/compiler/GHC/Driver/MakeFile.hs b/compiler/GHC/Driver/MakeFile.hs index 81336912de..f654d0a7fa 100644 --- a/compiler/GHC/Driver/MakeFile.hs +++ b/compiler/GHC/Driver/MakeFile.hs @@ -359,27 +359,20 @@ endMkDependHS logger dflags case makefile_hdl of Nothing -> return () Just hdl -> do - - -- slurp the rest of the original makefile and copy it into the output - let slurp = do - l <- hGetLine hdl - hPutStrLn tmp_hdl l - slurp - - catchIO slurp - (\e -> if isEOFError e then return () else ioError e) - + -- slurp the rest of the original makefile and copy it into the output + SysTools.copyHandle hdl tmp_hdl hClose hdl hClose tmp_hdl -- make sure it's flushed -- Create a backup of the original makefile - when (isJust makefile_hdl) - (SysTools.copy logger dflags ("Backing up " ++ makefile) - makefile (makefile++".bak")) + when (isJust makefile_hdl) $ do + showPass logger dflags ("Backing up " ++ makefile) + SysTools.copyFile makefile (makefile++".bak") -- Copy the new makefile in place - SysTools.copy logger dflags "Installing new makefile" tmp_file makefile + showPass logger dflags "Installing new makefile" + SysTools.copyFile tmp_file makefile ----------------------------------------------------------------- |