on main help sign in
fix(lint): require `exec.CommanadContext` over `exec.Command`
5569be6Christian Rocha
internal/cmd/root.go+5−5
@@ -655,11 +655,11 @@ func startDetachedServer(cmd *cobra.Command, hostURL *url.URL) error {
655 cmdArgs = append(cmdArgs, "--host", clientHost)
655 cmdArgs = append(cmdArgs, "--host", clientHost)
656 }
656 }
657
657
658− // Use exec.Command (not exec.CommandContext) so the parent's context
658+ // Use context.Background() so the parent's context cancellation does not
659− // cancellation does not kill the spawned server. detachProcess
659+ // kill the spawned server. detachProcess (Setsid on !windows,
660− // (Setsid on !windows, DETACHED_PROCESS on windows) is what truly
660+ // DETACHED_PROCESS on windows) is what truly detaches the child from
661− // detaches the child from this process's lifetime.
661+ // this process's lifetime.
662− c := exec.Command(exe, cmdArgs...)
662+ c := exec.CommandContext(context.Background(), exe, cmdArgs...)
663 stdoutPath := filepath.Join(chDir, "stdout.log")
663 stdoutPath := filepath.Join(chDir, "stdout.log")
664 stderrPath := filepath.Join(chDir, "stderr.log")
664 stderrPath := filepath.Join(chDir, "stderr.log")
665 detachProcess(c)
665 detachProcess(c)