diff options
-rw-r--r-- | compiler/main/DriverPipeline.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 04576e715c..70c2d7ae1f 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1339,7 +1339,12 @@ runPhase (RealPhase (As with_cpp)) input_fn dflags ]) 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) |