Merge pull request #2819 from hden/fix-path

Quick fix for node v0.10 path
This commit is contained in:
Jeremy Ashkenas
2013-03-13 01:03:57 -07:00
2 changed files with 4 additions and 3 deletions

View File

@@ -110,7 +110,7 @@
}
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)));
mainModule.paths = require('module')._nodeModulePaths(path.dirname(fs.realpathSync(options.filename || '.')));
if (!helpers.isCoffee(mainModule.filename) || require.extensions) {
answer = compile(code, options);
patchStackTrace();

View File

@@ -105,7 +105,7 @@ exports.run = (code, options = {}) ->
mainModule.moduleCache and= {}
# Assign paths for node_modules loading
mainModule.paths = require('module')._nodeModulePaths path.dirname fs.realpathSync options.filename
mainModule.paths = require('module')._nodeModulePaths path.dirname fs.realpathSync options.filename or '.'
# Compile.
if not helpers.isCoffee(mainModule.filename) or require.extensions
@@ -277,4 +277,5 @@ formatSourcePosition = (frame, getSourceMapping) ->
else if functionName
"#{functionName} (#{fileLocation})"
else
fileLocation
fileLocation