Skip to content

Commit 08f6a51

Browse files
committed
shell: handle PermissionError when reading history file
Print a warning with a hint on how to clear extended attributes instead of silently ignoring the error. Signed-off-by: a-ramses <[email protected]>
1 parent e3b42cb commit 08f6a51

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

proxyclient/m1n1/shell.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ def init_history(self, histfile):
2727
readline.read_history_file(histfile)
2828
except FileNotFoundError:
2929
pass
30+
except PermissionError as e:
31+
print(f"Failed reading history from {histfile}: {e}", file=sys.stderr)
32+
if sys.platform == "darwin":
33+
print(f" On macOS this may be caused by extended attributes. "
34+
f"Try: xattr -c {histfile}", file=sys.stderr)
3035

3136
def save_history(self):
3237
readline.set_history_length(10000)

0 commit comments

Comments
 (0)