tmux.Session.Run
Go
- Python Unavailable
- Ruby Unavailable
- Lua Unavailable
- TypeScript Unavailable
- Rust Unavailable
- Go
- Java Unavailable
- .NET Unavailable
- C++ Unavailable
- Swift Unavailable
- Module
- tmux
- Declared in
- Session
- Package
- github.com/libtmux/libtmux-go/tmux
- Source
- tmux/session_run.go
- Run ( ctx : context.Context , command : string , options : RunOptions ) (RunResult, error)
-
Run starts command in a new window of this session, waits for it to finish, and reports its exit status and what its terminal showed. It is [os/exec] for a program that needs a terminal: the command runs with a tty, so it sees isatty, colour, and a width, and what comes back is the screen tmux rendered rather than the bytes the program wrote.
A nonzero status is a result, not an error; the error reports what tmux could not do. The wait is tmux's own signal, backed by a liveness check that widens from a quarter second in case that signal is lost: it needs no tmux binary on the command's PATH and returns as the process exits. A command that never exits holds Run until ctx ends. On error, Run removes its window regardless of
RunOptions.Keep, since Run gives the caller no other chance to retry or clean up; a bareSession.Startfollowed byRunning.Waitleaves that choice to the caller instead.Server.RunShellruns a command with no pane at all.
0 declared, 0 inherited