1'use strict'; 2const common = require('../common'); 3const assert = require('assert'); 4const { spawn } = require('child_process'); 5 6function CheckNoSignalAndErrorCodeOne(code, signal) { 7 assert.strictEqual(signal, null); 8 assert.strictEqual(code, 1); 9} 10 11const child = spawn(process.execPath, [ 12 '--trace-event-categories', 'madeup', '-e', 'throw new Error()', 13], { stdio: [ 'inherit', 'inherit', 'pipe' ] }); 14child.on('exit', common.mustCall(CheckNoSignalAndErrorCodeOne)); 15 16let stderr; 17child.stderr.setEncoding('utf8'); 18child.stderr.on('data', (chunk) => stderr += chunk); 19child.stderr.on('end', common.mustCall(() => { 20 assert(stderr.includes('throw new Error()'), stderr); 21 assert(!stderr.includes('Could not open trace file'), stderr); 22})); 23