# tmux Discussion #4016 — Reading Command Output in Control Mode ## Metadata | Field | Value | |---|---| | Institute | Molodetz Institute — Research & Retrieval Division | | Subject | shell-multiplexer-auto-attach | | Document type | Source Dossier | | Tier | 1 | | Source title | How to read command output when in Control mode (-CC) | | Source URL | https://github.com/orgs/tmux/discussions/4016 | | Source publisher / author | tmux project (GitHub Discussions) | | Source type | forum thread | | Source date (published) | Unknown — not stated | | Date researched | 2026-10-09 | | Researched by | tai (agent), model: Claude Sonnet 5, on behalf of retoor | | Research method | web search synthesis | | Confidence | Medium | | Status | Active | ## Summary A real reported integration bug: a Rust program driving tmux with a single `-C` found that tmux detached the client as soon as its stdin was piped (non-interactive), and could not read command output back on stdout at all. The fix required passing `-CC` twice. ## Key findings - `-C` alone is not sufficient for a piped/non-interactive client — tmux's detach-on-piped-stdin behavior silently breaks naive automation. - `-CC` (doubled) was the empirically-confirmed working flag for a programmatic client that pipes stdin and reads stdout, in the reporter's tmux version. ## Pros / strengths - A concrete, reproduced failure mode with a confirmed fix — exactly the kind of gotcha that would otherwise cost real debugging time when building a tai control-mode client. ## Cons / limitations / caveats - Behavior tied to a specific tmux version; the thread itself notes to check the current man page, since `-C`/`-CC` semantics have shifted across releases. ## Relevance to tai Directly actionable: when tai spawns `tmux -CC` as a subprocess with piped stdin/stdout (the natural way to drive it from Python), use `-CC` (doubled), not a single `-C`, and verify against the installed tmux version's man page before shipping. ## Changelog | Date | Change | |---|---| | 2026-10-09 | Initial dossier created. |