From a4151142a650dc72fe35bb7112586781d5f96eb9 Mon Sep 17 00:00:00 2001 From: yetone Date: Sat, 31 Oct 2026 17:28:57 +0800 Subject: [PATCH] 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 by c59c547c5). 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). --- internal/claudetui/child_unix.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/claudetui/child_unix.go b/internal/claudetui/child_unix.go index 82d632a83..77d8cedcd 100644 --- a/internal/claudetui/child_unix.go +++ b/internal/claudetui/child_unix.go @@ -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