Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Improve how REPL commands are evaled
Browse files Browse the repository at this point in the history
Before:
> {a: 1}
1
> (function() {
...   // foo
...   return 1;
... })();
...

Now:
> {a: 1}
{ a : 1 }
> (function() {
...   // foo
...   return 1;
... })();
1
>
  • Loading branch information
ry committed Jan 2, 2011
1 parent ce5ddac commit b45698e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ function REPLServer(prompt, stream) {
if (!skipCatchall) {
// The catchall for errors
try {
self.buffered_cmd += cmd;
self.buffered_cmd += '\n' + cmd;
// This try is for determining if the command is complete, or should
// continue onto the next line.
try {
// Use evalcx to supply the global context
var ret = evalcx(self.buffered_cmd, context, 'repl');
var ret = evalcx('(' + self.buffered_cmd + ')', context, 'repl');
if (ret !== undefined) {
context._ = ret;
self.stream.write(exports.writer(ret) + '\n');
Expand Down

0 comments on commit b45698e

Please sign in to comment.