| 1 | //go:build !windows |
| 2 | |
| 3 | package control |
| 4 | |
| 5 | import ( |
| 6 | "os/exec" |
| 7 | "testing" |
| 8 | ) |
| 9 | |
| 10 | func TestSetShellKillTreeDetachesControllingTerminal(t *testing.T) { |
| 11 | cmd := exec.Command("sh", "-c", "true") |
| 12 | setShellKillTree(cmd) |
| 13 | |
| 14 | if cmd.SysProcAttr == nil { |
| 15 | t.Fatal("SysProcAttr is nil") |
| 16 | } |
| 17 | if !cmd.SysProcAttr.Setsid { |
| 18 | t.Fatal("shell commands should run in a new session so interactive prompts cannot grab the TUI terminal") |
| 19 | } |
| 20 | } |
| 21 |