Skip to content

Commit 0f8eabd

Browse files
fix: hand TTY to tmux via syscall.Exec in session at (gt-cuo)
runSessionAttach was calling tmux via exec.Command(...).Run() with buffered stdout/stderr, so tmux saw pipes instead of a TTY and failed with "open terminal failed: not a terminal". Use attachToTmuxSession() (already used by crew at, handoff, mayor, witness, refinery, deacon), which syscall.Exec's tmux on Unix so it inherits the parent shell's controlling terminal directly. Windows path uses the existing stdio-passthrough wrapper. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 677877b commit 0f8eabd

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

internal/cmd/session.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,18 @@ func runSessionAttach(cmd *cobra.Command, args []string) error {
336336
return err
337337
}
338338

339-
// Attach (this replaces the process)
340-
return polecatMgr.Attach(polecatName)
339+
running, err := polecatMgr.IsRunning(polecatName)
340+
if err != nil {
341+
return fmt.Errorf("checking session: %w", err)
342+
}
343+
if !running {
344+
return polecat.ErrSessionNotFound
345+
}
346+
347+
// Hand the terminal off to tmux via syscall.Exec so tmux inherits our
348+
// controlling TTY directly. Running tmux as a subprocess with buffered
349+
// stdio triggers "open terminal failed: not a terminal".
350+
return attachToTmuxSession(polecatMgr.SessionName(polecatName))
341351
}
342352

343353
// SessionListItem represents a session in list output.

0 commit comments

Comments
 (0)