summaryrefslogtreecommitdiff
path: root/lib/internal/repl.js
diff options
context:
space:
mode:
authorTodd Kennedy <todd@selfassembled.org>2015-08-19 15:44:20 -0700
committerJeremiah Senkpiel <fishrock123@rocketmail.com>2015-08-20 10:29:35 -0400
commit3849750a09394070053eabca022c980ef52ded75 (patch)
tree73fb9ad34d60441e122dc8514833eee91851c2b7 /lib/internal/repl.js
parent291b310e219023c4d93b216b1081ef47386f8750 (diff)
downloadandroid-node-v8-3849750a09394070053eabca022c980ef52ded75.tar.gz
android-node-v8-3849750a09394070053eabca022c980ef52ded75.tar.bz2
android-node-v8-3849750a09394070053eabca022c980ef52ded75.zip
repl: dont throw ENOENT on NODE_REPL_HISTORY_FILE
If you have no history file written to disk, but the environment variable set, `fs.readFileSync` will throw an ENOENT error, but there's nothing to convert. The converter should ignore ENOENT on that `fs.readFileSync` call. Fixes: https://github.com/nodejs/node/issues/2449 PR-URL: https://github.com/nodejs/node/pull/2451 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Diffstat (limited to 'lib/internal/repl.js')
-rw-r--r--lib/internal/repl.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/internal/repl.js b/lib/internal/repl.js
index 75909f72e2..b2c74e179c 100644
--- a/lib/internal/repl.js
+++ b/lib/internal/repl.js
@@ -122,8 +122,10 @@ function setupHistory(repl, historyPath, oldHistoryPath, ready) {
}
repl.history = repl.history.slice(-repl.historySize);
} catch (err) {
- return ready(
+ if (err.code !== 'ENOENT') {
+ return ready(
new Error(`Could not parse history data in ${oldHistoryPath}.`));
+ }
}
}