always enable command history in redis-cli

- when redis-cli is running in a TTY - always enable command history
buffering, regardless if history file path can be successfully
determined
This commit is contained in:
Tomasz Poradowski 2017-12-13 23:49:41 +01:00
parent de276b6a43
commit 77653ebe8a

View File

@ -1386,8 +1386,9 @@ static void repl(void) {
/* Only use history and load the rc file when stdin is a tty. */ /* Only use history and load the rc file when stdin is a tty. */
if (isatty(fileno(stdin))) { if (isatty(fileno(stdin))) {
historyfile = getDotfilePath(REDIS_CLI_HISTFILE_ENV,REDIS_CLI_HISTFILE_DEFAULT); historyfile = getDotfilePath(REDIS_CLI_HISTFILE_ENV,REDIS_CLI_HISTFILE_DEFAULT);
if (historyfile != NULL) { //keep in-memory history always regardless if history file can be determined
history = 1; history = 1;
if (historyfile != NULL) {
linenoiseHistoryLoad(historyfile); linenoiseHistoryLoad(historyfile);
} }
cliLoadPreferences(); cliLoadPreferences();