fix(sprite): add 60s timeout to destroyServer to prevent hanging (#2096)

The sprite destroy command can hang indefinitely when the Sprite API
is unresponsive. Add a 60s timeout using the existing killWithTimeout
utility (same pattern as runSprite).

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: L <6723574+louisgv@users.noreply.github.com>
Co-authored-by: A <258483684+la14-1@users.noreply.github.com>
This commit is contained in:
Ahmed Abushagur 2026-03-01 22:37:57 -08:00 committed by GitHub
parent 3911b5bc28
commit 297e7ff21c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -642,7 +642,10 @@ export async function destroyServer(name?: string): Promise<void> {
);
// Drain stderr before awaiting exit to prevent pipe buffer deadlock
const stderrText = new Response(proc.stderr).text();
// 60s timeout — sprite destroy should not hang indefinitely
const timer = setTimeout(() => killWithTimeout(proc), 60_000);
const exitCode = await proc.exited;
clearTimeout(timer);
if (exitCode !== 0) {
logError(`Failed to destroy sprite '${target}'`);
logError(`Delete it manually: sprite destroy ${target}`);