mirror of
https://github.com/stablyai/orca.git
synced 2026-10-25 00:03:59 +00:00
test(daemon): preserve pre-ready crash output
This commit is contained in:
@@ -44,6 +44,20 @@ describe('observeDaemonChildExit', () => {
|
||||
observer.stop()
|
||||
})
|
||||
|
||||
it('retains fatal stderr that arrives before the independent ready IPC callback', () => {
|
||||
const child = createChild()
|
||||
const onExit = vi.fn()
|
||||
const observer = observeDaemonChildExit(child, onExit)
|
||||
|
||||
child.stderr.write('FATAL ERROR before ready dispatch')
|
||||
observer.markReady()
|
||||
child.emit('close', 134, null)
|
||||
|
||||
expect(onExit).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ stderrTail: 'FATAL ERROR before ready dispatch' })
|
||||
)
|
||||
})
|
||||
|
||||
it('stops observing and destroys the startup pipe on launch failure', () => {
|
||||
const child = createChild()
|
||||
const destroy = vi.spyOn(child.stderr, 'destroy')
|
||||
|
||||
@@ -72,7 +72,6 @@ export function observeDaemonChildExit(
|
||||
return
|
||||
}
|
||||
ready = true
|
||||
stderrTail = Buffer.alloc(0)
|
||||
child.stderr?.on('error', onStderrError)
|
||||
child.stderr?.unref?.()
|
||||
child.on('close', onClose)
|
||||
|
||||
Reference in New Issue
Block a user