| 1 | //go:build !windows |
| 2 | |
| 3 | package plugin |
| 4 | |
| 5 | import ( |
| 6 | "context" |
| 7 | "os/exec" |
| 8 | "testing" |
| 9 | ) |
| 10 | |
| 11 | func TestStdioShellPATHProbeDetachesControllingTerminal(t *testing.T) { |
| 12 | cmd := exec.CommandContext(context.Background(), "sh", "-c", "true") |
| 13 | prepareStdioShellPATHProbe(cmd) |
| 14 | |
| 15 | if cmd.SysProcAttr == nil { |
| 16 | t.Fatal("SysProcAttr is nil") |
| 17 | } |
| 18 | if !cmd.SysProcAttr.Setsid { |
| 19 | t.Fatal("stdio login shell PATH probe should run in a new session so an interactive shell cannot take the TUI foreground") |
| 20 | } |
| 21 | } |
| 22 |