Avoid crashing on setup tools fatal errors

This commit is contained in:
Zanie 2024-01-17 08:03:46 -06:00
parent 4c9de3883c
commit 9c25fc9787
1 changed files with 5 additions and 1 deletions

View File

@ -138,10 +138,14 @@ def run_once(stdin: TextIO, stdout: TextIO):
# Respect SIGTERM and SIGINT
if (
isinstance(exc, (SystemExit, KeyboardInterrupt))
isinstance(exc, SystemExit)
# setutools will throw `SystemExit` on incorrect usage so do not treat
# it as a SIGTERM
and build_backend_name != "setuptools.build_meta:__legacy__"
):
raise
elif isinstance(exc, KeyboardInterrupt):
raise
raise HookRuntimeError(exc) from exc
else: