Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions cmd/dynamic.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"os/exec"
"strconv"
"strings"
"syscall"
"time"

"github.com/pipeboard-co/pipeboard-cli/internal/client"
Expand Down Expand Up @@ -69,7 +68,7 @@ func maybeAutoRefresh(cache *ToolsCache) {
}
cmd := exec.Command(self, "refresh", "--if-changed")
cmd.Env = append(os.Environ(), "PIPEBOARD_AUTO_REFRESH=1")
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
setSysProcAttr(cmd)
cmd.Stdout = nil
cmd.Stderr = nil
_ = cmd.Start()
Expand Down
14 changes: 14 additions & 0 deletions cmd/proc_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//go:build !windows

package cmd

import (
"os/exec"
"syscall"
)

// setSysProcAttr detaches the subprocess into its own process group
// so it survives after the parent exits.
func setSysProcAttr(cmd *exec.Cmd) {
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
}
9 changes: 9 additions & 0 deletions cmd/proc_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//go:build windows

package cmd

import "os/exec"

// setSysProcAttr is a no-op on Windows; the subprocess runs independently
// by default when stdout/stderr are nil.
func setSysProcAttr(cmd *exec.Cmd) {}
Loading