fix(e2b): harden remote teardown transactions

This commit is contained in:
Tianyi Cui
2026-07-29 07:03:04 +08:00
parent 62df6d0c09
commit ec0310ca1b
19 changed files with 712 additions and 135 deletions
+2 -4
View File
@@ -46,14 +46,12 @@ export class E2BSubprocessService extends SubprocessService {
const pending: Promise<unknown>[] = []
for (const handle of handles) {
handle.terminate()
pending.push(handle.done.catch(() => {}).then(() => handle.waitForExit()))
pending.push(handle.waitForExit().then(() => { this.live.delete(handle) }))
}
for (const terminal of terminals) {
terminal.terminate()
pending.push(terminal.waitForExit())
pending.push(terminal.waitForExit().then(() => { this.terminals.delete(terminal) }))
}
this.live.clear()
this.terminals.clear()
await Promise.all(pending)
}, 'e2b subprocess teardown')
}