Pane.run
Runs a shell command in this pane to its end, and answers with its exit status and output.
Source and package
- Qualified name
-
io.github .libtmux .Pane. run - Package
- io.github.libtmux
- Declared in
Pane- Distribution
- io.github.libtmux:libtmux
- Source
- libtmux/src/main/java/io/github/libtmux/Pane.java
-
Description#
Reach for this first whenever the command is yours. Nothing is inferred from the screen: the command runs in a subshell of the pane's own shell, whose trap reports
$?and signals a privatewait-forchannel, so the wait is tmux's and the status is the shell's. The trap covers interrupt and terminate as well as exit, so a command someone stops at the pane ends this call with the status it was stopped with rather than leaving it waiting. The output is what the command printed and nothing else — not the typed line, not the prompt — cut out between two markers the plumbing prints around it.It runs in the shell a person set up — its directory, its environment, a virtualenv someone activated — which is the reason to type it there rather than start a process of your own. The pane has to be running a POSIX shell for the typed line to mean what it says.
A command still running at the deadline keeps running; the answer carries what it had printed by then, and
PaneRun#exact()is false.Examples#
PaneRun built = pane.run("make test", Duration.ofMinutes(5));if (!built.succeeded()) {System.err.println(String.join("\n", built.output()));}- Parameters
- Raises
-
-
Illegal
State – if the pane is not running a POSIX shellException -
Interrupted
Exception – if the waiting thread is interrupted
-