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:
parent
46d9573c68
commit
8d63f4037e
@ -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');
|
||||
}));
|
||||
|
Loading…
x
Reference in New Issue
Block a user