Avoid a crash when we can't access a history file

This commit is contained in:
Kodi Arfer 2019-08-16 19:03:34 -04:00
parent 2942419bc8
commit ad74a92e2d
2 changed files with 6 additions and 2 deletions

View File

@ -21,6 +21,7 @@ Bug Fixes
* Statements in the second argument of `assert` are now executed. * Statements in the second argument of `assert` are now executed.
* Fixed the expression of a while loop that contains statements being compiled twice. * Fixed the expression of a while loop that contains statements being compiled twice.
* `hy2py` can now handle format strings. * `hy2py` can now handle format strings.
* Fixed crashes from inaccessible history files.
0.17.0 0.17.0
============================== ==============================

View File

@ -123,7 +123,7 @@ def completion(completer=None):
try: try:
readline.read_history_file(history) readline.read_history_file(history)
except IOError: except IOError:
open(history, 'a').close() pass
readline.parse_and_bind(readline_bind) readline.parse_and_bind(readline_bind)
@ -131,4 +131,7 @@ def completion(completer=None):
yield yield
finally: finally:
if docomplete: if docomplete:
readline.write_history_file(history) try:
readline.write_history_file(history)
except IOError:
pass