mirror of
https://github.com/stablyai/orca.git
synced 2026-10-24 00:04:01 +00:00
fix(daemon): handle startup stderr errors
This commit is contained in:
@@ -86,6 +86,16 @@ describe('observeDaemonChildExit', () => {
|
||||
expect(onExit).toHaveBeenCalledOnce()
|
||||
})
|
||||
|
||||
it('swallows stderr errors before readiness', () => {
|
||||
const child = createChild()
|
||||
const onExit = vi.fn()
|
||||
const observer = observeDaemonChildExit(child, onExit)
|
||||
|
||||
expect(() => child.stderr.emit('error', new Error('startup pipe error'))).not.toThrow()
|
||||
expect(onExit).not.toHaveBeenCalled()
|
||||
observer.stop()
|
||||
})
|
||||
|
||||
it('does not infer an exit from stderr or contact loss', () => {
|
||||
const child = createChild()
|
||||
const onExit = vi.fn()
|
||||
|
||||
@@ -101,6 +101,7 @@ export function observeDaemonChildExit(
|
||||
}
|
||||
|
||||
child.stderr?.on('data', onStderr)
|
||||
child.stderr?.on('error', onStderrError)
|
||||
child.stderr?.on('end', onStderrEnd)
|
||||
child.stderr?.on('close', onStderrEnd)
|
||||
|
||||
@@ -113,7 +114,6 @@ export function observeDaemonChildExit(
|
||||
return
|
||||
}
|
||||
ready = true
|
||||
child.stderr?.on('error', onStderrError)
|
||||
child.stderr?.unref?.()
|
||||
child.on('exit', onProcessExit)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user