Answer stability round 2: 1 🔴, 2 🟡 (0 misread); run Stryker as @stryker-mutator/core, pass an interrupted tool SIGINT before the kill, test SIGHUP, and print a failed Stryker or Infection run's whole report
CI / tests (pull_request) Successful in 2m24s

This commit was merged in pull request #488.
This commit is contained in:
2026-11-11 21:59:52 +01:00
parent 563e8cdc3c
commit cd2ac5d727
5 changed files with 90 additions and 56 deletions
+13 -4
View File
@@ -12,6 +12,8 @@ import tempfile
from failure import Failure
GRACE_SECONDS = 10 # how long an interrupted tool has to stop on the SIGINT it is passed, before it is killed
@dataclasses.dataclass(frozen=True)
class Ran:
@@ -32,10 +34,17 @@ def run_tool(argv: list[str], cwd: str, prefix: str | None) -> Ran | Failure:
try:
output = process.communicate()[0]
except BaseException:
# The run is ending, as on Ctrl-C or the SIGTERM the launcher turns into SystemExit, so end what the tool started too.
with contextlib.suppress(ProcessLookupError):
os.killpg(process.pid, signal.SIGKILL)
process.wait()
# The run is ending, as on Ctrl-C or the SIGTERM the launcher turns into SystemExit, so end what the tool started too. Ctrl-C
# reaches only this process, so pass the tool SIGINT first: a container's CLI, such as docker compose, then stops its container.
try:
with contextlib.suppress(ProcessLookupError):
os.killpg(process.pid, signal.SIGINT)
with contextlib.suppress(subprocess.TimeoutExpired):
process.wait(timeout=GRACE_SECONDS)
finally:
with contextlib.suppress(ProcessLookupError):
os.killpg(process.pid, signal.SIGKILL)
process.wait()
raise
return Ran(process.returncode, output)