From 2bc1dbbedf84636d283b43129f8876cf4d15af5f Mon Sep 17 00:00:00 2001 From: Fredrik Johansson Date: Mon, 22 Jun 2026 22:11:20 +0200 Subject: [PATCH] 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 --- cmd/daemon/main.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/daemon/main.go b/cmd/daemon/main.go index 2857e9d..dedddf5 100644 --- a/cmd/daemon/main.go +++ b/cmd/daemon/main.go @@ -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) } }