1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

Use coffee binary of coffee that overrode fork

This solves two potential problems when it comes to forking:

    1) Forking will now work correctly even when `coffee` is not installed
       globally.
    2) Forking when using a locally installed version of `coffee` will fork
       using that version, and not fallback to a globally installed version.

Fixes #2957
This commit is contained in:
Mal Graty 2013-08-02 23:10:45 +01:00
parent 8cf6f62ea4
commit 3c2f0d174e
2 changed files with 6 additions and 3 deletions

View file

@ -1,6 +1,6 @@
// Generated by CoffeeScript 1.6.3
(function() {
var Lexer, Module, SourceMap, child_process, compile, compileFile, ext, fileExtensions, findExtension, fork, formatSourcePosition, fs, getSourceMap, helpers, lexer, loadFile, parser, path, sourceMaps, vm, withPrettyErrors, _i, _len,
var Lexer, Module, SourceMap, binary, child_process, compile, compileFile, ext, fileExtensions, findExtension, fork, formatSourcePosition, fs, getSourceMap, helpers, lexer, loadFile, parser, path, sourceMaps, vm, withPrettyErrors, _i, _len,
__hasProp = {}.hasOwnProperty,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
@ -22,6 +22,8 @@
exports.VERSION = '1.6.3';
binary = require.resolve('../../bin/coffee');
fileExtensions = ['.coffee', '.litcoffee', '.coffee.md'];
exports.helpers = helpers;
@ -241,7 +243,7 @@
if (options == null) {
options = {};
}
execPath = helpers.isCoffee(path) ? 'coffee' : null;
execPath = helpers.isCoffee(path) ? binary : null;
if (!Array.isArray(args)) {
args = [];
options = args || {};

View file

@ -15,6 +15,7 @@ SourceMap = require './sourcemap'
# The current CoffeeScript version number.
exports.VERSION = '1.6.3'
binary = require.resolve '../../bin/coffee'
fileExtensions = ['.coffee', '.litcoffee', '.coffee.md']
# Expose helpers for testing.
@ -202,7 +203,7 @@ if require.extensions
if child_process
{fork} = child_process
child_process.fork = (path, args = [], options = {}) ->
execPath = if helpers.isCoffee(path) then 'coffee' else null
execPath = if helpers.isCoffee(path) then binary else null
if not Array.isArray args
args = []
options = args or {}