mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 21:35:34 +00:00

The only test with modifications is `test-stdin-child-proc` that was passing when it should not because the exit code of the child process was not being checked. PR-URL: https://github.com/nodejs/node/pull/6087 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com>
33 lines
685 B
JavaScript
33 lines
685 B
JavaScript
'use strict';
|
|
require('../common');
|
|
var assert = require('assert');
|
|
|
|
var spawn = require('child_process').spawn;
|
|
var child = spawn(process.execPath, [], {
|
|
env: Object.assign(process.env, {
|
|
NODE_DEBUG: process.argv[2]
|
|
})
|
|
});
|
|
var wanted = child.pid + '\n';
|
|
var found = '';
|
|
|
|
child.stdout.setEncoding('utf8');
|
|
child.stdout.on('data', function(c) {
|
|
found += c;
|
|
});
|
|
|
|
child.stderr.setEncoding('utf8');
|
|
child.stderr.on('data', function(c) {
|
|
console.error('> ' + c.trim().split(/\n/).join('\n> '));
|
|
});
|
|
|
|
child.on('close', function(c) {
|
|
assert(!c);
|
|
assert.equal(found, wanted);
|
|
console.log('ok');
|
|
});
|
|
|
|
setTimeout(function() {
|
|
child.stdin.end('console.log(process.pid)');
|
|
});
|