mirror of
https://github.com/nodejs/node.git
synced 2025-05-03 02:06:12 +00:00

Removes the incorrect 'exit successfully' message from test when the exit code is 0. PR-URL: https://github.com/nodejs/node/pull/14918 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
32 lines
1007 B
JavaScript
32 lines
1007 B
JavaScript
'use strict';
|
|
// Refs: https://github.com/nodejs/node/issues/947
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const cp = require('child_process');
|
|
|
|
if (process.argv[2] === 'child') {
|
|
process.on('message', common.mustCall((msg) => {
|
|
assert.strictEqual(msg, 'go');
|
|
// the following console.log is an integral part
|
|
// of the test. If this regress, this call will
|
|
// cause the process to exit with 1
|
|
console.log('logging should not cause a crash');
|
|
process.disconnect();
|
|
}));
|
|
} else {
|
|
// Passing '--inspect', '--inspect-brk' to child.spawn enables
|
|
// the debugger. This test was added to help debug the fork-based
|
|
// test with the same name.
|
|
const child = cp.spawn(process.execPath, [__filename, 'child'], {
|
|
stdio: ['pipe', 'pipe', 'pipe', 'ipc']
|
|
});
|
|
|
|
child.on('close', common.mustCall((exitCode, signal) => {
|
|
assert.strictEqual(exitCode, 0);
|
|
assert.strictEqual(signal, null);
|
|
}));
|
|
|
|
child.stdout.destroy();
|
|
child.send('go');
|
|
}
|