test,tracing: use close event to wait for stdio

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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Anna Henningsen 2019-02-02 15:56:43 +01:00
parent 46d9573c68
commit 8d63f4037e
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9

View File

@ -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');
}));
@ -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');
}));