diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-03-03 00:16:00 -0500 |
---|---|---|
committer | Ben Gamari <ben@well-typed.com> | 2019-03-04 10:18:41 -0500 |
commit | e7080bef906b66d0e7053db99c9733aa95059d42 (patch) | |
tree | ecd7137e99df8117bc6318a89cd46f63570524e6 /compiler/main | |
parent | 22c2713bcc30cea9da7d8b95f3ea99357d1551f7 (diff) | |
download | haskell-e7080bef906b66d0e7053db99c9733aa95059d42.tar.gz |
Revert "compiler: Refactor: extract `withAtomicRename`"
This reverts commit e8a08f400744a860d1366c6680c8419d30f7cc2a.
Diffstat (limited to 'compiler/main')
-rw-r--r-- | compiler/main/DriverPipeline.hs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index f1ef637037..3f59ed3bbf 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1341,10 +1341,7 @@ runPhase (RealPhase (As with_cpp)) input_fn dflags let local_includes = [ SysTools.Option ("-iquote" ++ p) | p <- includePathsQuote cmdline_include_paths ] let runAssembler inputFilename outputFilename - = liftIO $ do - withAtomicRename outputFilename $ \temp_outputFilename -> do - as_prog - dflags + = liftIO $ as_prog dflags (local_includes ++ global_includes -- See Note [-fPIC for assembler] ++ map SysTools.Option pic_c_flags @@ -1374,11 +1371,15 @@ runPhase (RealPhase (As with_cpp)) input_fn dflags , SysTools.Option "-c" , SysTools.FileOption "" inputFilename , SysTools.Option "-o" - , SysTools.FileOption "" temp_outputFilename + , SysTools.FileOption "" outputFilename ]) liftIO $ debugTraceMsg dflags 4 (text "Running the assembler") - runAssembler input_fn output_fn + + -- Atomic write by writing to temp file and then renaming + let temp_output_fn = output_fn <.> "tmp" + runAssembler input_fn temp_output_fn + liftIO $ renameFile temp_output_fn output_fn return (RealPhase next_phase, output_fn) |