From ceac074dad2744e23e319551059c70aefe70270d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 15 Jan 2024 21:10:21 +0530 Subject: [PATCH] Try to print the Apple crash report on test run failure --- .github/workflows/ci.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.py b/.github/workflows/ci.py index a34ae1dc3..34500884d 100644 --- a/.github/workflows/ci.py +++ b/.github/workflows/ci.py @@ -2,6 +2,7 @@ # vim:fileencoding=utf-8 # License: GPLv3 Copyright: 2020, Kovid Goyal +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():