mirror of
https://github.com/kanaka/mal.git
synced 2024-11-09 18:06:35 +03:00
Correct issue where readline bombs out if there's no existing history file.
This commit is contained in:
parent
b3402a82d3
commit
4cd2926224
@ -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++) {
|
||||
|
Loading…
Reference in New Issue
Block a user