colors: Add error handling to reload

This commit is contained in:
Dylan Araps 2017-06-21 22:32:34 +10:00
parent b684e1604e
commit 0a64877b1e

7
wal
View File

@ -498,7 +498,10 @@ def read_file(input_file):
def reload_colors(vte): def reload_colors(vte):
"""Reload colors.""" """Reload colors."""
with open(CACHE_DIR / "sequences") as file: sequence_file = pathlib.Path(CACHE_DIR / "sequences")
if sequence_file.is_file():
with open(sequence_file, "r") as file:
sequences = file.read() sequences = file.read()
# If vte mode was used, remove the problem sequence. # If vte mode was used, remove the problem sequence.
@ -507,8 +510,8 @@ def reload_colors(vte):
# Decode the string. # Decode the string.
sequences = bytes(sequences, "utf-8").decode("unicode_escape") sequences = bytes(sequences, "utf-8").decode("unicode_escape")
print(sequences, end="") print(sequences, end="")
quit() quit()