Unverified Commit ec20e246 authored by mknichel's avatar mknichel Committed by GitHub

[Traces] Await the flush of the trace write stream to make sure trace file is written (#57641)

This PR fixes an issue where sometimes the `.next/trace` file would not be written at the end of a build. The process was not waiting for the write stream to be flushed before closing, losing the contents of the trace, which was especially visible when using `experimental-compile`.
parent 71116ce3
...@@ -174,7 +174,7 @@ export default { ...@@ -174,7 +174,7 @@ export default {
const phase = traceGlobals.get('phase') const phase = traceGlobals.get('phase')
// Only end writeStream when manually flushing in production // Only end writeStream when manually flushing in production
if (phase !== PHASE_DEVELOPMENT_SERVER) { if (phase !== PHASE_DEVELOPMENT_SERVER) {
writeStream.end() return writeStream.end()
} }
}) })
: undefined, : undefined,
......
Markdown is supported
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