| 48 | } |
| 49 | |
| 50 | async function postRun() { |
| 51 | const ctrl = new AbortController(); |
| 52 | const timer = setTimeout(() => ctrl.abort(), RUN_TIMEOUT_MS); |
| 53 | try { |
| 54 | const res = await fetch(`http://127.0.0.1:${PORT}/run`, { |
| 55 | method: "POST", |
| 56 | headers: { "content-type": "application/json" }, |
| 57 | body: JSON.stringify({ repo: REPO, verify: ["ls"], timeoutMs: 30_000 }), |
| 58 | signal: ctrl.signal, |
| 59 | }); |
| 60 | const body = await res.json(); |
| 61 | if (!res.ok || !body || body.ok !== true) { |
| 62 | throw new Error(`runner /run returned ${res.status}: ${JSON.stringify(body)}`); |
| 63 | } |
| 64 | return body; |
| 65 | } finally { |
| 66 | clearTimeout(timer); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | async function main() { |
| 71 | if (!hasDocker()) { |