11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci// Refs: https://github.com/nodejs/node/issues/947 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciconst assert = require('assert'); 51cb0ef41Sopenharmony_ciconst cp = require('child_process'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ciif (process.argv[2] === 'child') { 81cb0ef41Sopenharmony_ci process.on('message', common.mustCall((msg) => { 91cb0ef41Sopenharmony_ci assert.strictEqual(msg, 'go'); 101cb0ef41Sopenharmony_ci // The following console.log is an integral part 111cb0ef41Sopenharmony_ci // of the test. If this regress, this call will 121cb0ef41Sopenharmony_ci // cause the process to exit with 1 131cb0ef41Sopenharmony_ci console.log('logging should not cause a crash'); 141cb0ef41Sopenharmony_ci process.disconnect(); 151cb0ef41Sopenharmony_ci })); 161cb0ef41Sopenharmony_ci} else { 171cb0ef41Sopenharmony_ci const child = cp.fork(__filename, ['child'], { silent: true }); 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_ci child.on('close', common.mustCall((exitCode, signal) => { 201cb0ef41Sopenharmony_ci assert.strictEqual(exitCode, 0); 211cb0ef41Sopenharmony_ci assert.strictEqual(signal, null); 221cb0ef41Sopenharmony_ci })); 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_ci child.stdout.destroy(); 251cb0ef41Sopenharmony_ci child.send('go'); 261cb0ef41Sopenharmony_ci} 27