m1n1.shell: carry on if saving history fails

This shouldn't crash the shell — it's enough to warn about it and
carry on.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
This commit is contained in:
Alyssa Ross 2023-10-28 20:49:31 +00:00 committed by Hector Martin
parent 9a277fadc9
commit 0d5454e235

View file

@ -30,7 +30,10 @@ class HistoryConsole(code.InteractiveConsole):
def save_history(self):
readline.set_history_length(10000)
readline.write_history_file(self.histfile)
try:
readline.write_history_file(self.histfile)
except OSError as e:
print(f"Failed writing history to {self.histfile}: {e}", file=sys.stderr)
def showtraceback(self):
type, value, tb = sys.exc_info()