Skip to content

repl: Fixed node repl history edge case. Fixes #4102.

Rodrigo Muino Tomonari requested to merge github/fork/zeusdeux/issue-4102 into master

If the deprecated NODE_REPL_HISTORY_FILE is set to default node history file path ($HOME/.node_repl_history) and the file doesn't exist, then node creates the file and then crashes when it tries to parse that file as JSON thinking that it's an older JSON formatted history file. This fixes that bug.

This patch also prevents node repl from throwing if the old history file is empty or if $HOME/.node_repl_history is empty.

Also, in the test file, I moved the file paths above common messages to make it easier to shift to template strings in the future to build the messages.

Merge request reports

Loading