1'use strict'; 2// Tests that a spawned child process can write to stdout without throwing. 3// See https://github.com/nodejs/node-v0.x-archive/issues/1899. 4 5require('../common'); 6const fixtures = require('../common/fixtures'); 7const assert = require('assert'); 8const spawn = require('child_process').spawn; 9 10const child = spawn(process.argv[0], [ 11 fixtures.path('GH-1899-output.js'), 12]); 13let output = ''; 14 15child.stdout.on('data', function(data) { 16 output += data; 17}); 18 19child.on('exit', function(code, signal) { 20 assert.strictEqual(code, 0); 21 assert.strictEqual(output, 'hello, world!\n'); 22}); 23