ScriptedTmux
ScriptedTmux writes an executable that answers tmux invocations from script and returns its absolute path, for tmux.ServerOptions.Binary. It is how a test drives code that uses this package without a tmux to drive:
Source and package
- Qualified name
-
tmuxtest.Scripted Tmux - Package
- tmuxtest
- Distribution
- github.com/libtmux/libtmux-go/tmux
- Source
- tmux/tmuxtest/scripted.go
-
Description#
server, err := tmux.NewServer(tmux.ServerOptions{Binary: tmuxtest.ScriptedTmux(t,tmuxtest.ScriptedCommand{Contains: []string{"-V"}, Stdout: "tmux 3.7\n"},tmuxtest.ScriptedCommand{Contains: []string{"kill-pane"},Stderr: "can't find pane: %7\n",ExitCode: 1,},),})The executable is removed with the test. It answers commands only: opening a control connection or a notification stream speaks tmux's control protocol, which a script cannot, so code that opens one needs
NewServerand a real tmux.The private version probe reports no daemon unless an entry explicitly matches its complete format argument. An entry that does so answers with the record in Stdout; the script reports it the way tmux does, as the refusal of the probe's random command word on stderr. Ordinary commands then use the executable version supplied by the script's -V answer.
- Parameters
-