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

Commit

Permalink
debugger: don't allow users to input non-valid commands
Browse files Browse the repository at this point in the history
Fixes #1144.
  • Loading branch information
Siddharth Mahendraker authored and ry committed Jun 3, 2011
1 parent 1d7a46a commit 37d529f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/_debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ Interface.prototype.handleCommand = function(cmd) {
self._lastCommand = null;
self.tryQuit();

} else if (/^r(un)?/.test(cmd)) {
} else if (/^r(un)?$/.test(cmd)) {
self._lastCommand = null;
if (self.child) {
self.restartQuestion(function(yes) {
Expand All @@ -805,7 +805,7 @@ Interface.prototype.handleCommand = function(cmd) {
self.trySpawn();
}

} else if (/^help/.test(cmd)) {
} else if (/^help$/.test(cmd)) {
console.log(helpMessage);
term.prompt();

Expand All @@ -819,7 +819,7 @@ Interface.prototype.handleCommand = function(cmd) {
term.prompt();
});

} else if (/info +breakpoints/.test(cmd)) {
} else if (/^info(\s+breakpoint)?$/.test(cmd)) {
if (!client) {
self.printNotConnected();
return;
Expand Down Expand Up @@ -867,7 +867,7 @@ Interface.prototype.handleCommand = function(cmd) {
term.prompt();
});

} else if (/^backtrace/.test(cmd) || /^bt/.test(cmd)) {
} else if (/^b(ack)?t(race)?$/.test(cmd)) {
if (!client) {
self.printNotConnected();
return;
Expand Down Expand Up @@ -905,7 +905,7 @@ Interface.prototype.handleCommand = function(cmd) {
self.printScripts(cmd.indexOf('full') > 0);
term.prompt();

} else if (/^c(ontinue)?/.test(cmd)) {
} else if (/^c(ontinue)?$/.test(cmd)) {
if (!client) {
self.printNotConnected();
return;
Expand All @@ -916,7 +916,7 @@ Interface.prototype.handleCommand = function(cmd) {
self.resume();
});

} else if (/^k(ill)?/.test(cmd)) {
} else if (/^k(ill)?$/.test(cmd)) {
if (!client) {
self.printNotConnected();
return;
Expand All @@ -934,7 +934,7 @@ Interface.prototype.handleCommand = function(cmd) {
self.term.prompt();
}

} else if (/^next/.test(cmd) || /^n/.test(cmd)) {
} else if (/^n(ext)?$/.test(cmd)) {
if (!client) {
self.printNotConnected();
return;
Expand All @@ -943,7 +943,7 @@ Interface.prototype.handleCommand = function(cmd) {
// Wait for break point. (disable raw mode?)
});

} else if (/^step/.test(cmd) || /^s/.test(cmd)) {
} else if (/^s(tep)?$/.test(cmd)) {
if (!client) {
self.printNotConnected();
return;
Expand All @@ -952,7 +952,7 @@ Interface.prototype.handleCommand = function(cmd) {
// Wait for break point. (disable raw mode?)
});

} else if (/^print/.test(cmd) || /^p/.test(cmd)) {
} else if (/^p(rint)?$/.test(cmd)) {
if (!client) {
self.printNotConnected();
return;
Expand Down

0 comments on commit 37d529f

Please sign in to comment.