Runner: Docker-Zeitlimit liefert sicher 124 nach rm -f
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bcc0e42374
commit
12513b73c3
2 files changed
+47
-2
No files matched your search
@@ -139,6 +139,7 @@ export function createDocker({ exec = spawnDocker, baseEnv = process.env, envDir
|
||||
child.stdout?.on('data', (d) => split.push(String(d)));
|
||||
child.stderr?.on('data', (d) => split2.push(String(d)));
|
||||
let done = false;
|
||||
let timedOut = false;
|
||||
let timer;
|
||||
const finish = (res) => {
|
||||
if (done) return;
|
||||
@@ -148,10 +149,16 @@ export function createDocker({ exec = spawnDocker, baseEnv = process.env, envDir
|
||||
split.flush(); split2.flush();
|
||||
resolve(res);
|
||||
};
|
||||
child.on('error', (e) => { if (!done) { done = true; clearTimeout(timer); envFile?.cleanup(); reject(e); } });
|
||||
child.on('close', (code) => finish({ code: code ?? 1 }));
|
||||
child.on('error', (e) => {
|
||||
if (done) return;
|
||||
if (timedOut) return; // Zeitlimit-Pfad löst selbst auf (124)
|
||||
done = true; clearTimeout(timer); envFile?.cleanup(); reject(e);
|
||||
});
|
||||
child.on('close', (code) => { if (!timedOut) finish({ code: code ?? 1 }); });
|
||||
if (timeoutMs > 0) {
|
||||
timer = setTimeout(async () => {
|
||||
if (done) return;
|
||||
timedOut = true;
|
||||
try { child.kill('SIGKILL'); } catch { /* schon beendet */ }
|
||||
const name = optionName(args);
|
||||
if (name) await forceRemove(name);
|
||||
|
||||
Reference in new issue
Block a user