Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit cd8c5e609610bb38ca7d6dffee679713a1acc849 1 parent 6945f97
@miksago miksago authored
Showing with 7 additions and 5 deletions.
  1. +4 −4 lib/child_process.js
  2. +3 −1 lib/cluster.js
View
8 lib/child_process.js
@@ -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
4 lib/cluster.js
@@ -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;
Please sign in to comment.
Something went wrong with that request. Please try again.