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

Commit

Permalink
repl: fix passing an empty line inserting "undefined" into the buffer
Browse files Browse the repository at this point in the history
There was a possiblity of insering the string "undefined" into the repl's
command buffer, which would cause interesting results while evaluating.
  • Loading branch information
TooTallNate committed Jul 4, 2012
1 parent 6a11f3e commit 9126dd2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/repl.js
Expand Up @@ -883,6 +883,7 @@ function trimWhitespace(cmd) {
if (matches && matches.length === 2) {
return matches[1];
}
return '';
}


Expand Down
4 changes: 3 additions & 1 deletion test/simple/test-repl.js
Expand Up @@ -152,7 +152,9 @@ function error_test() {
{ client: client_unix, send: 'npm install foobar',
expect: expect_npm },
{ client: client_unix, send: '(function () {\n\nreturn 1;\n})()',
expect: '1' }
expect: '1' },
{ client: client_unix, send: '{\n\na: 1\n}',
expect: '{ a: 1 }' }
]);
}

Expand Down

1 comment on commit 9126dd2

@rlidwka
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TooTallNate :

debugger relied on this:
https://github.com/joyent/node/blob/master/lib/_debugger.js#L955

it would be nice to fix it too :)

Please sign in to comment.