Fixing the REPL.

This commit is contained in:
Jeremy Ashkenas 2010-10-24 21:15:20 -04:00
parent 13f6b037e2
commit a75368e2e8
4 changed files with 4 additions and 4 deletions

View File

@ -48,7 +48,7 @@
}; };
exports.eval = function(code, options) { exports.eval = function(code, options) {
var __dirname, __filename; var __dirname, __filename;
__filename = fs.realpathSync(options.fileName); __filename = options.fileName;
__dirname = path.dirname(__filename); __dirname = path.dirname(__filename);
return eval(exports.compile(code, options)); return eval(exports.compile(code, options));
}; };

View File

@ -18,7 +18,7 @@
fileName: 'repl' fileName: 'repl'
}); });
if (val !== undefined) { if (val !== undefined) {
console.log(inspect(val)); console.log(val);
} }
} catch (err) { } catch (err) {
console.error(err.stack || err.toString()); console.error(err.stack || err.toString());

View File

@ -65,7 +65,7 @@ exports.run = (code, options) ->
# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment). # Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).
# The CoffeeScript REPL uses this to run the input. # The CoffeeScript REPL uses this to run the input.
exports.eval = (code, options) -> exports.eval = (code, options) ->
__filename = fs.realpathSync options.fileName __filename = options.fileName
__dirname = path.dirname __filename __dirname = path.dirname __filename
eval exports.compile(code, options) eval exports.compile(code, options)

View File

@ -21,7 +21,7 @@ helpers.extend global, quit: -> process.exit(0)
run = (buffer) -> run = (buffer) ->
try try
val = CoffeeScript.eval buffer.toString(), bare: on, globals: on, fileName: 'repl' val = CoffeeScript.eval buffer.toString(), bare: on, globals: on, fileName: 'repl'
console.log inspect val if val isnt undefined console.log val if val isnt undefined
catch err catch err
console.error err.stack or err.toString() console.error err.stack or err.toString()
repl.prompt() repl.prompt()