mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
Fix child_process.fork patch
* Preserve `options` when called without `args` * Don't use `coffee` script as `execPath` (Fixes #2919)
This commit is contained in:
@@ -51,19 +51,14 @@
|
||||
fork = child_process.fork;
|
||||
binary = require.resolve('../../bin/coffee');
|
||||
child_process.fork = function(path, args, options) {
|
||||
var execPath;
|
||||
if (args == null) {
|
||||
args = [];
|
||||
if (helpers.isCoffee(path)) {
|
||||
if (!Array.isArray(args)) {
|
||||
options = args || {};
|
||||
args = [];
|
||||
}
|
||||
args = [path].concat(args);
|
||||
path = binary;
|
||||
}
|
||||
if (options == null) {
|
||||
options = {};
|
||||
}
|
||||
execPath = helpers.isCoffee(path) ? binary : null;
|
||||
if (!Array.isArray(args)) {
|
||||
args = [];
|
||||
options = args || {};
|
||||
}
|
||||
options.execPath || (options.execPath = execPath);
|
||||
return fork(path, args, options);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -42,10 +42,11 @@ if require.extensions
|
||||
if child_process
|
||||
{fork} = child_process
|
||||
binary = require.resolve '../../bin/coffee'
|
||||
child_process.fork = (path, args = [], options = {}) ->
|
||||
execPath = if helpers.isCoffee(path) then binary else null
|
||||
if not Array.isArray args
|
||||
args = []
|
||||
options = args or {}
|
||||
options.execPath or= execPath
|
||||
child_process.fork = (path, args, options) ->
|
||||
if helpers.isCoffee path
|
||||
unless Array.isArray args
|
||||
options = args or {}
|
||||
args = []
|
||||
args = [path].concat args
|
||||
path = binary
|
||||
fork path, args, options
|
||||
Reference in New Issue
Block a user