Skip to content

Commit 54db6a5

Browse files
authored
fix: wait for child stdio close before resolving exec (#1855)
1 parent 7b89438 commit 54db6a5

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/job.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,9 @@ If you know what you're doing and would like to suppress this warning, use one o
11651165
cp.stdout?.pipe(split2()).on("data", (e: string) => outFunc(e, writeStreams.stdout.bind(writeStreams), (s) => chalk`{greenBright ${s}}`));
11661166
cp.stderr?.pipe(split2()).on("data", (e: string) => outFunc(e, writeStreams.stderr.bind(writeStreams), (s) => chalk`{redBright ${s}}`));
11671167
}
1168-
void cp.on("exit", (code) => {
1168+
// Wait for "close" rather than "exit" so all stdout/stderr data events
1169+
// have flushed to the output log file before we resolve.
1170+
void cp.on("close", (code) => {
11691171
clearTimeout(this._longRunningSilentTimeout);
11701172
return resolve(code ?? 0);},
11711173
);

0 commit comments

Comments
 (0)