0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-process-external-stdio-close.js
Sebastiaan Deckers bb29405904
lib,src: fix consistent spacing inside braces
PR-URL: https://github.com/nodejs/node/pull/14162
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-07-21 15:13:47 -04:00

27 lines
793 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 {
const child = cp.fork(__filename, ['child'], { silent: true });
child.on('close', common.mustCall((exitCode, signal) => {
assert.strictEqual(exitCode, 0);
assert.strictEqual(signal, null);
}));
child.stdout.destroy();
child.send('go');
}