fix: run TCP and WS IPC concurrently, fail only if either dies
Previously --ws-port started WS in a goroutine then called Run() which blocked; if TCP IPC failed it took the whole process down even though WS was up. Now both run in goroutines and the first error from either kills the daemon. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -82,15 +82,15 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
errCh := make(chan error, 2)
|
||||
|
||||
go func() { errCh <- ipc.Run(mgr, *ipcPort) }()
|
||||
|
||||
if *wsPort != 0 {
|
||||
go func() {
|
||||
if err := ipc.RunWS(mgr, *wsPort); err != nil {
|
||||
log.Fatalf("ipc ws: %v", err)
|
||||
}
|
||||
}()
|
||||
go func() { errCh <- ipc.RunWS(mgr, *wsPort) }()
|
||||
}
|
||||
|
||||
if err := ipc.Run(mgr, *ipcPort); err != nil {
|
||||
if err := <-errCh; err != nil {
|
||||
log.Fatalf("ipc: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user