fix(subprocess): await control endpoint closure during disposal
This commit is contained in:
1 parent
838da1d07e
commit
562e7f364e
2 files changed
+5
-1
No files matched your search
@@ -113,7 +113,10 @@ export class LocalSubprocessRuntime extends SubprocessRuntime {
|
||||
pending.push(terminal.terminate().then(() => { this.terminals.delete(terminal) }))
|
||||
}
|
||||
const outcomes = await Promise.allSettled(pending)
|
||||
for (const control of this.controlChannels) control.destroy()
|
||||
await Promise.all([...this.controlChannels].map(control => new Promise<void>((resolveClose) => {
|
||||
control.once('close', () => { resolveClose() })
|
||||
control.destroy()
|
||||
})))
|
||||
this.controlChannels.clear()
|
||||
const failures: unknown[] = []
|
||||
for (const outcome of outcomes) {
|
||||
|
||||
@@ -46,6 +46,7 @@ describe('managed subprocess control pipe', () => {
|
||||
expect(await handle.waitForExit(AbortSignal.timeout(10_000))).toBe(true)
|
||||
await ctx.fiber.dispose()
|
||||
expect(channel.destroyed).toBe(true)
|
||||
expect(channel.closed).toBe(true)
|
||||
}, 15_000)
|
||||
|
||||
it('closes the caller endpoint when service disposal terminates an active program', async () => {
|
||||
|
||||
Reference in new issue
Block a user