diff options
author | Todd Kennedy <todd@selfassembled.org> | 2015-08-19 15:44:20 -0700 |
---|---|---|
committer | Jeremiah Senkpiel <fishrock123@rocketmail.com> | 2015-08-20 10:29:35 -0400 |
commit | 3849750a09394070053eabca022c980ef52ded75 (patch) | |
tree | 73fb9ad34d60441e122dc8514833eee91851c2b7 /lib/internal/repl.js | |
parent | 291b310e219023c4d93b216b1081ef47386f8750 (diff) | |
download | android-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.js | 4 |
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}.`)); + } } } |