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 <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
addaleax committed Feb 5, 2019
1 parent 46d9573 commit 8d63f40
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 8d63f40

Please sign in to comment.