From 2a58af2be95a1ad810387abd809cda2eddb223ea Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 5 Jan 2022 14:04:56 +0530 Subject: [PATCH] Ignore all errors rendering /etc/issue --- kitty/debug_config.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/kitty/debug_config.py b/kitty/debug_config.py index 200bf0494..68d2bb9c3 100644 --- a/kitty/debug_config.py +++ b/kitty/debug_config.py @@ -223,8 +223,18 @@ def debug_config(opts: KittyOpts) -> str: import subprocess p(' '.join(subprocess.check_output(['sw_vers']).decode('utf-8').splitlines()).strip()) if os.path.exists('/etc/issue'): - with open('/etc/issue', encoding='utf-8', errors='replace') as f: - p(end=''.join(IssueData().parse_issue_file(f))) + try: + idata = IssueData() + except Exception: + pass + else: + with open('/etc/issue', encoding='utf-8', errors='replace') as f: + try: + datums = idata.parse_issue_file(f) + except Exception: + pass + else: + p(end=''.join(datums)) if os.path.exists('/etc/lsb-release'): with open('/etc/lsb-release', encoding='utf-8', errors='replace') as f: p(f.read().strip())