| 1 | //go:build !windows |
| 2 | |
| 3 | package proc |
| 4 | |
| 5 | import ( |
| 6 | "os/exec" |
| 7 | "syscall" |
| 8 | ) |
| 9 | |
| 10 | // PrepareShellPATHProbe detaches a short-lived login-shell PATH probe from the |
| 11 | // caller's controlling-terminal session. Interactive login shells may enable job |
| 12 | // control and become the TTY foreground process group; running them in a new |
| 13 | // session prevents that from stopping the TUI with SIGTTIN. |
| 14 | func PrepareShellPATHProbe(cmd *exec.Cmd) { |
| 15 | if cmd.SysProcAttr == nil { |
| 16 | cmd.SysProcAttr = &syscall.SysProcAttr{} |
| 17 | } |
| 18 | cmd.SysProcAttr.Setsid = true |
| 19 | } |
| 20 |