|
|
@ -160,13 +160,23 @@ function setupChannel(target, channel) { |
|
|
|
|
|
|
|
function nop() { } |
|
|
|
|
|
|
|
exports.fork = function(modulePath /*, args, options*/) { |
|
|
|
|
|
|
|
exports.fork = function(modulePath, args, options) { |
|
|
|
if (!options) options = {}; |
|
|
|
// Get options and args arguments.
|
|
|
|
var options, args; |
|
|
|
if (Array.isArray(arguments[1])) { |
|
|
|
args = arguments[1]; |
|
|
|
options = arguments[2] || {}; |
|
|
|
} else { |
|
|
|
args = []; |
|
|
|
options = arguments[1] || {}; |
|
|
|
} |
|
|
|
|
|
|
|
args = args ? args.slice(0) : []; |
|
|
|
// Copy args and add modulePath
|
|
|
|
args = args.slice(0); |
|
|
|
args.unshift(modulePath); |
|
|
|
|
|
|
|
// Don't allow stdinStream and customFds since a stdin channel will be used
|
|
|
|
if (options.stdinStream) { |
|
|
|
throw new Error('stdinStream not allowed for fork()'); |
|
|
|
} |
|
|
|