From: Ryan Dahl Date: Wed, 11 May 2011 20:32:40 +0000 (-0700) Subject: Rename spawnNode to fork X-Git-Tag: v0.5.0~140 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=337c48db5fe06ddaf626b03b7db6c6f48c5d3b62;p=platform%2Fupstream%2Fnodejs.git Rename spawnNode to fork --- diff --git a/doc/api/child_processes.markdown b/doc/api/child_processes.markdown index 48493bc..56dd6f5 100644 --- a/doc/api/child_processes.markdown +++ b/doc/api/child_processes.markdown @@ -179,7 +179,7 @@ amount of data allowed on stdout or stderr - if this value is exceeded then 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 @@ -191,7 +191,7 @@ For example: 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); diff --git a/lib/child_process.js b/lib/child_process.js index 44732c8..353bfe5 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -59,7 +59,7 @@ function setupChannel(target, fd) { } -exports.spawnNode = function(modulePath, args, options) { +exports.fork = function(modulePath, args, options) { if (!options) options = {}; options.wantChannel = true; @@ -81,7 +81,7 @@ exports.spawnNode = function(modulePath, args, options) { }; -exports._spawnNodeChild = function(fd) { +exports._forkChild = function(fd) { setupChannel(process, fd); }; diff --git a/src/node.js b/src/node.js index ee8d184..190bbdf 100644 --- a/src/node.js +++ b/src/node.js @@ -317,7 +317,7 @@ 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); } } diff --git a/src/node_child_process.cc b/src/node_child_process.cc index a0a465e..4d14800 100644 --- a/src/node_child_process.cc +++ b/src/node_child_process.cc @@ -345,7 +345,7 @@ int ChildProcess::Spawn(const char *file, } - // 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 diff --git a/test/simple/test-child-process-spawn-node.js b/test/simple/test-child-process-spawn-node.js index 7c895c3..1079d95 100644 --- a/test/simple/test-child-process-spawn-node.js +++ b/test/simple/test-child-process-spawn-node.js @@ -1,8 +1,8 @@ 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;