Skip to content

Commit

Permalink
fix: handle exceptions if readline history fails to write
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Dec 3, 2024
1 parent 6e4e331 commit c60eb88
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gptme/util/readline.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ def add_history(line: str) -> None: # pragma: no cover
load_readline_history()

readline.add_history(line)
readline.write_history_file(get_readline_history_file())
hist_file = get_readline_history_file()
try:
readline.write_history_file(hist_file)
except Exception as e:
logger.warning(f"Failed to write history file {hist_file}: {e}")


def load_readline_history() -> None: # pragma: no cover
Expand Down

0 comments on commit c60eb88

Please sign in to comment.