Patch child_process.fork to run .coffee files

This commit is contained in:
Michael Smith
2013-02-28 17:51:55 -08:00
parent 5dea70b82e
commit c98fae59fc
4 changed files with 47 additions and 7 deletions

View File

@@ -1,12 +1,14 @@
// Generated by CoffeeScript 1.5.0
(function() {
var Lexer, compile, ext, fs, helpers, lexer, loadFile, parser, path, vm, _i, _len, _ref,
var Lexer, child_process, compile, ext, fs, helpers, lexer, loadFile, parser, path, vm, _i, _len, _ref,
__hasProp = {}.hasOwnProperty;
fs = require('fs');
path = require('path');
child_process = require('child_process');
Lexer = require('./lexer').Lexer;
parser = require('./parser').parser;
@@ -33,6 +35,19 @@
}
}
(function(fork) {
return child_process.fork = function(modulePath) {
var oldExecPath, output;
oldExecPath = process.execPath;
if (helpers.isCoffee(modulePath)) {
process.execPath = 'coffee';
}
output = fork.apply(this, arguments);
process.execPath = oldExecPath;
return output;
};
})(child_process.fork);
exports.VERSION = '1.5.0';
exports.helpers = require('./helpers');