fix(subagent): close terminal teardown races
This commit is contained in:
@@ -668,7 +668,6 @@ describe('coverage seams', () => {
|
||||
it('terminate() after the tree died delivers no termination signal', async () => {
|
||||
const running = spawnSubprocess(spec('true'))
|
||||
await running.done
|
||||
await running.waitForExit()
|
||||
const spy = vi.spyOn(process, 'kill')
|
||||
try {
|
||||
running.terminate()
|
||||
@@ -677,6 +676,21 @@ describe('coverage seams', () => {
|
||||
} finally {
|
||||
spy.mockRestore()
|
||||
}
|
||||
await running.waitForExit()
|
||||
})
|
||||
|
||||
it('repeated terminate after exit never probes or signals a reused process group', async () => {
|
||||
const running = spawnSubprocess(spec('sleep 60'))
|
||||
running.terminate()
|
||||
await running.done
|
||||
await running.waitForExit()
|
||||
const spy = vi.spyOn(process, 'kill').mockImplementation(() => true)
|
||||
try {
|
||||
running.terminate()
|
||||
expect(spy).not.toHaveBeenCalled()
|
||||
} finally {
|
||||
spy.mockRestore()
|
||||
}
|
||||
})
|
||||
|
||||
it('waitForExit on a failed spawn reports exited immediately', async () => {
|
||||
|
||||
Reference in New Issue
Block a user