HCoop
/
jackhill
/
mal.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b3402a8
)
Correct issue where readline bombs out if there's no existing history file.
author
Wes Brown
<wesbrown18@gmail.com>
Tue, 22 Apr 2014 16:40:20 +0000
(12:40 -0400)
committer
Wes Brown
<wesbrown18@gmail.com>
Tue, 22 Apr 2014 16:40:20 +0000
(12:40 -0400)
js/node_readline.js
patch
|
blob
|
blame
|
history
diff --git
a/js/node_readline.js
b/js/node_readline.js
index
f91bbaf
..
0585e0f
100644
(file)
--- a/
js/node_readline.js
+++ b/
js/node_readline.js
@@
-20,7
+20,10
@@
exports.readline = rlwrap.readline = function(prompt) {
if (!rl_history_loaded) {
rl_history_loaded = true;
- var lines = fs.readFileSync(HISTORY_FILE).toString().split("\n");
+ var lines = [];
+ if (fs.existsSync(HISTORY_FILE)) {
+ lines = fs.readFileSync(HISTORY_FILE).toString().split("\n");
+ }
// Max of 2000 lines
lines = lines.slice(Math.max(lines.length - 2000, 0));
for (var i=0; i<lines.length; i++) {