2 // Refs: https://github.com/nodejs/node/issues/947
3 const common = require('../common');
4 const assert = require('assert');
5 const cp = require('child_process');
7 if (process.argv[2] === 'child') {
8 process.on('message', common.mustCall((msg) => {
9 assert.strictEqual(msg, 'go');
10 console.log('logging should not cause a crash');
14 const child = cp.fork(__filename, ['child'], {silent: true});
16 child.on('close', common.mustCall((exitCode, signal) => {
17 assert.strictEqual(exitCode, 0);
18 assert.strictEqual(signal, null);
21 child.stdout.destroy();