Pass over a data source whose script the image cannot run

This commit is contained in:
2026-11-23 20:37:46 +01:00
parent 5727456738
commit c9948496eb
5 changed files with 34 additions and 11 deletions
+7 -1
View File
@@ -41,6 +41,12 @@ class TimedOut(Failure):
"""docker still ran when its time was up."""
@dataclasses.dataclass(frozen=True)
class NotStarted(Failure):
"""`docker run` exited with one of NOT_STARTED, as ran holds it."""
ran: Ran
class Docker(typing.Protocol):
"""Runs `docker <args>` and waits for it, at most `seconds`, and is TimedOut after that. Its output goes to `stdout` and its
errors to `stderr` where the call gives them, and into the Ran otherwise."""
@@ -148,7 +154,7 @@ def run_in_image(containers: Containers, args: list[str], stdout: typing.IO[byte
containers.docker(["rm", "--force", containers.running], seconds=120)
return ran
if ran.code in NOT_STARTED:
return Failure(f"docker run could not start its command, and exited {ran.code}: {ran.output.strip()}".removesuffix(": "))
return NotStarted(f"docker run could not start its command, and exited {ran.code}: {ran.output.strip()}".removesuffix(": "), ran)
return ran