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;
|
fork = child_process.fork;
|
||||||
binary = require.resolve('../../bin/coffee');
|
binary = require.resolve('../../bin/coffee');
|
||||||
child_process.fork = function(path, args, options) {
|
child_process.fork = function(path, args, options) {
|
||||||
var execPath;
|
if (helpers.isCoffee(path)) {
|
||||||
if (args == null) {
|
|
||||||
args = [];
|
|
||||||
}
|
|
||||||
if (options == null) {
|
|
||||||
options = {};
|
|
||||||
}
|
|
||||||
execPath = helpers.isCoffee(path) ? binary : null;
|
|
||||||
if (!Array.isArray(args)) {
|
if (!Array.isArray(args)) {
|
||||||
args = [];
|
|
||||||
options = args || {};
|
options = args || {};
|
||||||
|
args = [];
|
||||||
|
}
|
||||||
|
args = [path].concat(args);
|
||||||
|
path = binary;
|
||||||
}
|
}
|
||||||
options.execPath || (options.execPath = execPath);
|
|
||||||
return fork(path, args, options);
|
return fork(path, args, options);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,10 +42,11 @@ if require.extensions
|
||||||
if child_process
|
if child_process
|
||||||
{fork} = child_process
|
{fork} = child_process
|
||||||
binary = require.resolve '../../bin/coffee'
|
binary = require.resolve '../../bin/coffee'
|
||||||
child_process.fork = (path, args = [], options = {}) ->
|
child_process.fork = (path, args, options) ->
|
||||||
execPath = if helpers.isCoffee(path) then binary else null
|
if helpers.isCoffee path
|
||||||
if not Array.isArray args
|
unless Array.isArray args
|
||||||
args = []
|
|
||||||
options = args or {}
|
options = args or {}
|
||||||
options.execPath or= execPath
|
args = []
|
||||||
|
args = [path].concat args
|
||||||
|
path = binary
|
||||||
fork path, args, options
|
fork path, args, options
|
Loading…
Add table
Reference in a new issue