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

accept override

This commit is contained in:
Hao-kang Den 2013-03-12 14:33:55 +08:00
parent b7f0653a0e
commit 9b6772a390
2 changed files with 5 additions and 3 deletions

View file

@ -100,12 +100,14 @@
};
exports.run = function(code, options) {
var answer, mainModule;
var answer, mainModule, _ref1;
if (options == null) {
options = {};
}
mainModule = require.main;
options.sourceMap = true;
if ((_ref1 = options.sourceMap) == null) {
options.sourceMap = true;
}
mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '.';
mainModule.moduleCache && (mainModule.moduleCache = {});
mainModule.paths = require('module')._nodeModulePaths(path.dirname(fs.realpathSync(options.filename)));

View file

@ -96,7 +96,7 @@ exports.nodes = (source, options) ->
# setting `__filename`, `__dirname`, and relative `require()`.
exports.run = (code, options = {}) ->
mainModule = require.main
options.sourceMap = true
options.sourceMap ?= true
# Set the filename.
mainModule.filename = process.argv[1] =
if options.filename then fs.realpathSync(options.filename) else '.'