From c6f4c93d0afb149deb5f6faee5f79fa4d95d7853 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 16 Nov 2023 21:49:38 +0530 Subject: [PATCH] Nicer exit code diagnostic --- .github/workflows/ci.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.py b/.github/workflows/ci.py index 32f4ccca9..a34ae1dc3 100644 --- a/.github/workflows/ci.py +++ b/.github/workflows/ci.py @@ -20,11 +20,20 @@ SW = None def run(*a): if len(a) == 1: a = shlex.split(a[0]) - print(' '.join(map(shlex.quote, a))) + cmd = ' '.join(map(shlex.quote, a)) + print(cmd) sys.stdout.flush() ret = subprocess.Popen(a).wait() if ret != 0: - raise SystemExit(ret) + if ret < 0: + import signal + try: + sig = signal.Signals(-ret) + except ValueError: + pass + else: + 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}') def install_deps():