Skip to content

Commit 0d5454e

Browse files
alyssaismarcan
authored andcommitted
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>
1 parent 9a277fa commit 0d5454e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

proxyclient/m1n1/shell.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ def init_history(self, histfile):
3030

3131
def save_history(self):
3232
readline.set_history_length(10000)
33-
readline.write_history_file(self.histfile)
33+
try:
34+
readline.write_history_file(self.histfile)
35+
except OSError as e:
36+
print(f"Failed writing history to {self.histfile}: {e}", file=sys.stderr)
3437

3538
def showtraceback(self):
3639
type, value, tb = sys.exc_info()

0 commit comments

Comments
 (0)