Merge pull request #7586 from samccone/sjs/fix_webpack_profiling_race

Fix race condition in profiling plugin.
This commit is contained in:
Tobias Koppers 2018-06-24 10:43:12 +02:00 committed by GitHub
commit bb38c5d039
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -130,7 +130,14 @@ function createTrace(outputPath) {
trace,
counter,
profiler,
end: callback => fsStream.end(callback)
end: callback => {
// Wait until the write stream finishes.
fsStream.on("finish", () => {
callback();
});
// Tear down the readable trace stream.
trace.destroy();
}
};
}