Ignore all errors rendering /etc/issue

This commit is contained in:
Kovid Goyal 2022-01-05 14:04:56 +05:30
parent bfbe60c90e
commit 2a58af2be9
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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())