Skip to content

Commit

Permalink
test,tracing: use close event to wait for stdio
Browse files Browse the repository at this point in the history
Use `'close'` rather than `'exit'` to make sure that all stdio
has been captured by the time that the event handler is run.

PR-URL: #25894
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Anto Aravinth <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
addaleax committed Feb 6, 2019
1 parent 7035496 commit 2009f18
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/parallel/test-trace-events-category-used.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ let procEnabledOutput = '';

procEnabled.stdout.on('data', (data) => procEnabledOutput += data);
procEnabled.stderr.pipe(process.stderr);
procEnabled.once('exit', common.mustCall(() => {
procEnabled.once('close', common.mustCall(() => {
assert.strictEqual(procEnabledOutput, 'true\n');
}));

Expand All @@ -46,6 +46,6 @@ let procDisabledOutput = '';

procDisabled.stdout.on('data', (data) => procDisabledOutput += data);
procDisabled.stderr.pipe(process.stderr);
procDisabled.once('exit', common.mustCall(() => {
procDisabled.once('close', common.mustCall(() => {
assert.strictEqual(procDisabledOutput, 'false\n');
}));

0 comments on commit 2009f18

Please sign in to comment.