Fixing --eval; see issue 820
This commit is contained in:
parent
6d8126e498
commit
776b1b723e
|
@ -40,7 +40,11 @@
|
|||
while (root.parent) {
|
||||
root = root.parent;
|
||||
}
|
||||
root.filename = fs.realpathSync(options.fileName);
|
||||
if (options.fileName.length > 0) {
|
||||
root.filename = fs.realpathSync(options.fileName);
|
||||
} else {
|
||||
root.filename = fs.realpathSync('.');
|
||||
}
|
||||
if (root.moduleCache) {
|
||||
root.moduleCache = {};
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
return compileStdio();
|
||||
}
|
||||
if (opts.eval) {
|
||||
return compileScript('console', sources[0]);
|
||||
return compileScript('', sources[0]);
|
||||
}
|
||||
if (!sources.length) {
|
||||
return require('./repl');
|
||||
|
|
|
@ -53,7 +53,10 @@ exports.run = (code, options) ->
|
|||
while root.parent
|
||||
root = root.parent
|
||||
# Set the filename
|
||||
root.filename = fs.realpathSync options.fileName
|
||||
if options.fileName.length > 0
|
||||
root.filename = fs.realpathSync options.fileName
|
||||
else
|
||||
root.filename = fs.realpathSync '.' # run eval code in working directory
|
||||
# Clear the module cache
|
||||
root.moduleCache = {} if root.moduleCache
|
||||
# Compile
|
||||
|
|
|
@ -57,7 +57,7 @@ exports.run = ->
|
|||
return version() if opts.version
|
||||
return require './repl' if opts.interactive
|
||||
return compileStdio() if opts.stdio
|
||||
return compileScript 'console', sources[0] if opts.eval
|
||||
return compileScript '', sources[0] if opts.eval
|
||||
return require './repl' unless sources.length
|
||||
separator = sources.indexOf '--'
|
||||
flags = []
|
||||
|
|
Loading…
Reference in New Issue