mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-08-29 04:26:38 +00:00
test(pwsh-local): accept graceful SIGTERM exit as service-disposal death
On Linux, pwsh may trap SIGTERM and exit cleanly when the subprocess service is disposed, so the handle status is 'completed' rather than 'killed'. The test already proved the process tree is gone via kill(pid,0); both statuses satisfy the contract.
This commit is contained in:
@@ -471,10 +471,12 @@ describe.skipIf(!hasPwsh)('process lifecycle ownership (the subprocess service,
|
||||
await managerFiber.dispose()
|
||||
expect(() => process.kill(pid, 0)).toThrow()
|
||||
await proc.done
|
||||
// POSIX reports the kill as a signal; Windows reports a forced
|
||||
// termination as exit 1 with no signal (indistinguishable from a crash),
|
||||
// so the status stamp follows the platform's exit facts.
|
||||
expect(proc.status).toBe(process.platform === 'win32' ? 'completed' : 'killed')
|
||||
// Service disposal confirmed the tree is gone (kill(pid,0) throws above).
|
||||
// On POSIX the stamp depends on whether the shell traps SIGTERM and exits
|
||||
// cleanly (completed) or is killed by the signal (killed); Windows forced
|
||||
// termination (taskkill, no signals) also stamps completed. Both mean the
|
||||
// process no longer survives the service.
|
||||
expect(['killed', 'completed']).toContain(proc.status)
|
||||
})
|
||||
|
||||
it('service disposal settles running handles and leaves settled ones untouched', async () => {
|
||||
@@ -493,6 +495,11 @@ describe.skipIf(!hasPwsh)('process lifecycle ownership (the subprocess service,
|
||||
// A settled process was untouched; the live one was terminated and joined.
|
||||
expect(finished.status).toBe('completed')
|
||||
await running.done
|
||||
expect(running.status).toBe(process.platform === 'win32' ? 'completed' : 'killed')
|
||||
// The live handle was terminated and joined; on POSIX the stamp depends
|
||||
// on whether the shell traps SIGTERM and exits cleanly (completed) or is
|
||||
// killed by the signal (killed); Windows forced termination (taskkill, no
|
||||
// signals) also stamps completed. Both mean the process no longer
|
||||
// survives the service.
|
||||
expect(['killed', 'completed']).toContain(running.status)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user