Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

function libtmux-go latest

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.ScriptedTmux
Package
tmuxtest
Distribution
github.com/libtmux/libtmux-go/tmux
Source
tmux/tmuxtest/scripted.go
func ScriptedTmux( t testing.TB, script ...ScriptedCommand, ) string

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 NewServer and 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
Esc

Type to search.

Reference previewOpen reference