Commit c702bded authored by Jérome Perrin's avatar Jérome Perrin

client/console: don't fail writing history file when ~ is deleted

/reviewed-on nexedi/slapos.core!52
parent 5ff4cb4f
...@@ -139,7 +139,8 @@ def do_console(local): ...@@ -139,7 +139,8 @@ def do_console(local):
historyPath = os.path.expanduser("~/.slapconsolehistory") historyPath = os.path.expanduser("~/.slapconsolehistory")
def save_history(historyPath=historyPath): def save_history(historyPath=historyPath):
readline.write_history_file(historyPath) if os.path.exists(os.path.dirname(historyPath)):
readline.write_history_file(historyPath)
if os.path.exists(historyPath): if os.path.exists(historyPath):
readline.read_history_file(historyPath) readline.read_history_file(historyPath)
atexit.register(save_history) atexit.register(save_history)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment