terminal: restore HISTFILE on exit to let bash properly update ~/.bash_history

This commit is contained in:
Sergey Simonchik
2019-03-22 01:01:32 +03:00
parent e07f67f4d0
commit a1fbac8a0a
+3 -4
View File
@@ -70,12 +70,11 @@ function configureCommandHistory {
local commandHistoryFile="$__INTELLIJ_COMMAND_HISTFILE__"
if [ -n "$commandHistoryFile" ] && [ -z "`trap -p EXIT`" ]
then
if [ ! -s "$commandHistoryFile" ] && [ -f "$HISTFILE" ]
trap "history -w \"$commandHistoryFile\"; export HISTFILE=\"$HISTFILE\"" EXIT
if [ -s "$commandHistoryFile" ]
then
command cp "$HISTFILE" "$commandHistoryFile"
export HISTFILE="$commandHistoryFile"
fi
trap "history -w \"$HISTFILE\"" EXIT
export HISTFILE="$commandHistoryFile"
fi
}
configureCommandHistory