Permalink
Browse files

Fix #2034 no .clear in repl when useGlobal=true

  • Loading branch information...
1 parent 69d3bf1 commit 4d5a7a656ff325c0442d155410307e7dcda8111e @isaacs committed Nov 8, 2011
Showing with 11 additions and 9 deletions.
  1. +11 −9 lib/repl.js
View
20 lib/repl.js
@@ -597,15 +597,17 @@ function defineDefaultCommands(repl) {
}
});
- repl.defineCommand('clear', {
- help: 'Break, and also clear the local context',
- action: function() {
- this.outputStream.write('Clearing context...\n');
- this.bufferedCommand = '';
- this.resetContext(true);
- this.displayPrompt();
- }
- });
+ if (!repl.useGlobal) {
+ repl.defineCommand('clear', {
+ help: 'Break, and also clear the local context',
+ action: function() {
+ this.outputStream.write('Clearing context...\n');
+ this.bufferedCommand = '';
+ this.resetContext(true);
+ this.displayPrompt();
+ }
+ });
+ }
repl.defineCommand('exit', {
help: 'Exit the repl',

0 comments on commit 4d5a7a6

Please sign in to comment.