on main help sign in
fix(server): keep the spawned server alive after the parent exits

The parent process was creating the detached server via a context-bound command, so when the parent exited or its context was cancelled the runtime would also kill the brand new server we had just spawned. Drop the context binding and rely on the existing platform-specific detach to give the server a life of its own. Co-Authored-By: Charm Crush <crush@charm.land>

commit8021114b23ab5149fdb623bb44f61749ca7882bc authorChristian Rocha <christian@rocha.is> dateMon 11 May 2026, 15:59 (5 months ago) parent9b366c3
1 file changed+5−1
internal/cmd/root.go+5−1
internal/cmd/root.go+5−1
@@ -569,7 +569,11 @@ func startDetachedServer(cmd *cobra.Command) error {
569569 cmdArgs = append(cmdArgs, "--host", clientHost)
570570 }
571571
572− c := exec.CommandContext(cmd.Context(), exe, cmdArgs...)
572+ // Use exec.Command (not exec.CommandContext) so the parent's context
573+ // cancellation does not kill the spawned server. detachProcess
574+ // (Setsid on !windows, DETACHED_PROCESS on windows) is what truly
575+ // detaches the child from this process's lifetime.
576+ c := exec.Command(exe, cmdArgs...)
573577 stdoutPath := filepath.Join(chDir, "stdout.log")
574578 stderrPath := filepath.Join(chDir, "stderr.log")
575579 detachProcess(c)