Answer stability round 1: 0 🔴, 3 🟡 (0 misread); bound the forge's CLI with a timeout in one runner, and read a pull request from a deleted fork
CI / tests (pull_request) Successful in 3m20s
CI / tests (pull_request) Successful in 3m20s
This commit is contained in:
@@ -24,12 +24,15 @@ def url_beside(origin_url: str, name: str) -> str | None:
|
||||
return place.group(1) + name if place and not place.group(1).endswith("//") else None
|
||||
|
||||
|
||||
def runner(cwd: str) -> Run:
|
||||
def runner(cwd: str, timeout: float | None = None) -> Run:
|
||||
"""Runs a command in cwd, stopped after timeout seconds where one is given."""
|
||||
def run(command: list[str]) -> str | Failure:
|
||||
try:
|
||||
done = subprocess.run(command, capture_output=True, cwd=cwd, encoding="utf-8", errors="replace", stdin=subprocess.DEVNULL)
|
||||
done = subprocess.run(command, capture_output=True, cwd=cwd, encoding="utf-8", errors="replace", stdin=subprocess.DEVNULL, timeout=timeout)
|
||||
except OSError as failure:
|
||||
return Failure(f"{command[0]} could not start: {failure}")
|
||||
except subprocess.TimeoutExpired:
|
||||
return Failure(f"{' '.join(command[:3])}: stopped after {timeout} s")
|
||||
if done.returncode:
|
||||
return Failure(f"{' '.join(command[:3])}: {(done.stderr or done.stdout).strip()}")
|
||||
return done.stdout
|
||||
|
||||
Reference in New Issue
Block a user