mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05: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:
parent
308299fe04
commit
a6891e4feb
2 changed files with 14 additions and 18 deletions
|
@ -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
|
Loading…
Add table
Reference in a new issue