Try to print the Apple crash report on test run failure

This commit is contained in:
Kovid Goyal 2024-01-15 21:10:21 +05:30
parent 903dd26a08
commit ceac074dad
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -2,6 +2,7 @@
# vim:fileencoding=utf-8
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
import glob
import io
import os
import shlex
@ -17,7 +18,15 @@
SW = None
def run(*a):
def do_print_crash_reports():
for cdir in (os.path.expanduser('~/Library/Logs/DiagnosticReports'), '/Library/Logs/DiagnosticReports'):
for f in glob.glob(os.path.join(cdir, 'kitty_*')):
print(os.path.basename())
with open(f) as src:
print(src.read())
def run(*a, print_crash_reports=False):
if len(a) == 1:
a = shlex.split(a[0])
cmd = ' '.join(map(shlex.quote, a))
@ -32,6 +41,8 @@ def run(*a):
except ValueError:
pass
else:
if print_crash_reports:
do_print_crash_reports()
raise SystemExit(f'The following process was killed by signal: {sig.name}:\n{cmd}')
raise SystemExit(f'The following process failed with exit code: {ret}:\n{cmd}')
@ -74,7 +85,7 @@ def build_kitty():
def test_kitty():
run('./test.py')
run('./test.py', print_crash_reports=True)
def package_kitty():