mirror of
https://github.com/nodejs/node.git
synced 2024-11-25 08:19:38 +01:00
3e1b1dd4a9
The copyright and license notice is already in the LICENSE file. There is no justifiable reason to also require that it be included in every file, since the individual files are not individually distributed except as part of the entire package.
32 lines
812 B
JavaScript
32 lines
812 B
JavaScript
var assert = require('assert');
|
|
var common = require('../common');
|
|
var fork = require('child_process').fork;
|
|
var args = ['foo', 'bar'];
|
|
|
|
var n = fork(common.fixturesDir + '/child-process-spawn-node.js', args);
|
|
assert.deepEqual(args, ['foo', 'bar']);
|
|
|
|
var messageCount = 0;
|
|
|
|
n.on('message', function(m) {
|
|
console.log('PARENT got message:', m);
|
|
assert.ok(m.foo);
|
|
messageCount++;
|
|
});
|
|
|
|
// https://github.com/joyent/node/issues/2355 - JSON.stringify(undefined)
|
|
// returns "undefined" but JSON.parse() cannot parse that...
|
|
assert.throws(function() { n.send(undefined); }, TypeError);
|
|
assert.throws(function() { n.send(); }, TypeError);
|
|
|
|
n.send({ hello: 'world' });
|
|
|
|
var childExitCode = -1;
|
|
n.on('exit', function(c) {
|
|
childExitCode = c;
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.ok(childExitCode == 0);
|
|
});
|