projects
/
platform
/
upstream
/
nodejs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
244675c
)
readline: handle null completer graciously
author
Ben Noordhuis
<info@bnoordhuis.nl>
Wed, 14 Sep 2011 15:07:58 +0000
(17:07 +0200)
committer
Ben Noordhuis
<info@bnoordhuis.nl>
Wed, 14 Sep 2011 15:33:07 +0000
(17:33 +0200)
Fixes #1698.
lib/readline.js
patch
|
blob
|
history
diff --git
a/lib/readline.js
b/lib/readline.js
index e2b634a279df9117302e255ae815137374671196..6ced9a573e249a9b69cfb2c6ec873f6a804e9328 100644
(file)
--- a/
lib/readline.js
+++ b/
lib/readline.js
@@
-45,6
+45,12
@@
function Interface(input, output, completer) {
}
EventEmitter.call(this);
+ completer = completer || function() { return []; };
+
+ if (typeof completer !== 'function') {
+ throw new TypeError("Argument 'completer' must be a function");
+ }
+
var self = this;
this.output = output;
@@
-605,9
+611,7
@@
Interface.prototype._ttyWrite = function(s, key) {
break;
case 'tab': // tab completion
- if (this.completer) {
- this._tabComplete();
- }
+ this._tabComplete();
break;
case 'left':