Permalink
Browse files

Use process.execArgv in child_process.fork() and cluster.

  • Loading branch information...
1 parent 6945f97 commit cd8c5e609610bb38ca7d6dffee679713a1acc849 @miksago miksago committed Mar 5, 2012
Showing with 7 additions and 5 deletions.
  1. +4 −4 lib/child_process.js
  2. +3 −1 lib/cluster.js
View
@@ -165,7 +165,7 @@ function nop() { }
exports.fork = function(modulePath /*, args, options*/) {
// Get options and args arguments.
- var options, args;
+ var options, args, execArgv;
if (Array.isArray(arguments[1])) {
args = arguments[1];
options = arguments[2] || {};
@@ -174,9 +174,9 @@ exports.fork = function(modulePath /*, args, options*/) {
options = arguments[1] || {};
}
- // Copy args and add modulePath
- args = args.slice(0);
- args.unshift(modulePath);
+ // Prepare arguments for fork:
+ execArgv = options.execArgv || process.execArgv;
+ args = execArgv.concat([modulePath], args);
// Don't allow stdinStream and customFds since a stdin channel will be used
if (options.stdinStream) {
View
@@ -91,6 +91,7 @@ cluster.setupMaster = function(options) {
// Set settings object
settings = cluster.settings = {
exec: options.exec || process.argv[1],
+ execArgv: options.execArgv || process.execArgv,
args: options.args || process.argv.slice(2),
silent: options.silent || false
};
@@ -274,7 +275,8 @@ function Worker(customEnv) {
// fork worker
this.process = fork(settings.exec, settings.args, {
'env': envCopy,
- 'silent': settings.silent
+ 'silent': settings.silent,
+ 'execArgv': settings.execArgv
});
} else {
this.process = process;

0 comments on commit cd8c5e6

Please sign in to comment.