Fixing the REPL.
This commit is contained in:
parent
13f6b037e2
commit
a75368e2e8
|
@ -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));
|
||||||
};
|
};
|
||||||
|
|
|
@ -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());
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue