claudetui: the Unix pseudo-terminal child is made through proc.Command (#4491)
internal/claudetui/child_unix.go started Claude Code with exec.Command directly, so TestNoCommandBypassesProc was red on main since the interactive mode's Unix child landed (06c2c35d1, moved byc59c547c5). It now uses proc.Command, as the Windows pseudo-console sibling (child_windows.go) already does; the child keeps its *exec.Cmd and its Setsid/Setctty attributes, set after the command is made. The fix is yiqiui's, from #4491 (their branch fix/claudetui-proc-command, ca129fa72); applied here by hand. Run on mote (macOS) at this head: go test ./internal/proc ./internal/claudetui ok (the guard was red there before, in the full run of 97c5ce8ef's tree: "internal/claudetui/child_unix.go:32 runs a command with os/exec"); GOOS=linux go vet ./internal/claudetui clean; in WSL (magpie-desktop) go test ./internal/claudetui ok. Not tried: a real Claude Code TUI run after it; proc.Command adds nothing on Unix (hide and batch are no-ops there).
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/yetone/magpie/internal/proc"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
@@ -29,7 +30,7 @@ func (s *shim) start(path string, args []string) error {
|
||||
}
|
||||
// wide, so a line of Claude Code's screen is a line
|
||||
_ = unix.IoctlSetWinsize(int(tty.Fd()), unix.TIOCSWINSZ, &unix.Winsize{Row: 50, Col: 200})
|
||||
cmd := exec.Command(path, args...)
|
||||
cmd := proc.Command(path, args...)
|
||||
cmd.Env = childEnv()
|
||||
cmd.Stdin, cmd.Stdout, cmd.Stderr = tty, tty, tty
|
||||
// its own session, the terminal its controlling one: the shim ending
|
||||
|
||||
Reference in New Issue
Block a user