the child process is killed.
-### child_process.spawnNode(modulePath, arguments, options)
+### child_process.fork(modulePath, arguments, options)
This is a special case of the `spawn()` functionality for spawning Node
processes. In addition to having all the methods in a normal ChildProcess
var cp = require('child_process');
- var n = cp.spawnNode(__dirname + '/sub.js');
+ var n = cp.fork(__dirname + '/sub.js');
n.on('message', function(m) {
console.log('PARENT got message:', m);
}
-exports.spawnNode = function(modulePath, args, options) {
+exports.fork = function(modulePath, args, options) {
if (!options) options = {};
options.wantChannel = true;
};
-exports._spawnNodeChild = function(fd) {
+exports._forkChild = function(fd) {
setupChannel(process, fd);
};
var fd = parseInt(process.env.NODE_CHANNEL_FD);
assert(fd >= 0);
var cp = NativeModule.require('child_process');
- cp._spawnNodeChild(fd);
+ cp._forkChild(fd);
assert(process.send);
}
}
}
- // The channel will be used by spawnNode() for a little JSON channel.
+ // The channel will be used by js-land "fork()" for a little JSON channel.
// The pointer is used to pass one end of the socket pair back to the
// parent.
// channel_fds[0] is for the parent
var assert = require('assert');
var common = require('../common');
-var spawnNode = require('child_process').spawnNode;
+var fork = require('child_process').fork;
-var n = spawnNode(common.fixturesDir + '/child-process-spawn-node.js');
+var n = fork(common.fixturesDir + '/child-process-spawn-node.js');
var messageCount = 0;