# tmuxtest.NewControlMode

- **Module:** tmuxtest
- **Package:** github.com/libtmux/libtmux-go/tmux
- **Language:** Go
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-go/blob/5f808882015a975a65acc7f9da5b3ff0d5cbdc91/tmux/tmuxtest/control.go#L49
- **Page:** https://libtmux.org/reference/go/tmuxtest-newcontrolmode/

```
tmuxtest.NewControlMode(ctx: context.Context, t: testing.TB, server: tmux.Server, session: tmux.Session) -> *ControlMode
```

NewControlMode starts a [ControlMode] attached to session and registers cleanup with t. It requires an explicitly configured process environment and validates that session belongs to server. The client pins the server's frozen effective socket path. Validation or startup failures call [testing.TB.Fatal]. ctx bounds startup and registration only, not the returned client's lifetime.
