kill stuck tsgo process after timeout

This commit is contained in:
Alex Alecu
2026-03-17 11:26:04 +02:00
parent 12ef3336ef
commit be5709066f
+9 -1
View File
@@ -32,9 +32,17 @@ export namespace TsCheck {
env: { ...process.env },
})
const TIMEOUT = 30_000
const stdout = await new Response(proc.stdout).text()
const stderr = await new Response(proc.stderr).text()
await proc.exited
const exited = await Promise.race([
proc.exited.then(() => true),
new Promise<false>((r) => setTimeout(() => r(false), TIMEOUT)),
])
if (!exited) {
log.warn("ts check timed out, killing process", { elapsed: Date.now() - start })
proc.kill()
}
log.info("ts check done", {
elapsed: Date.now() - start,