Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

io.github.libtmux.Pane.Pane.run

Java
  • Python Unavailable
  • Ruby Unavailable
  • Lua Unavailable
  • TypeScript Unavailable
  • Rust Unavailable
  • Go Unavailable
  • Java
  • .NET Unavailable
  • C++ Unavailable
  • Swift Unavailable

View as Markdown

Module
io.github.libtmux.Pane
Declared in
Pane
Package
io.github.libtmux:libtmux
Source
libtmux/src/main/java/io/github/libtmux/Pane.java
run ( command : String , timeout : Duration ) → PaneRun
method [source]
method [source]
run

Runs a shell command in this pane to its end, and answers with its exit status and output.

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 private wait-for channel, 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
  • command ( String ) – a line of shell, run as eval would run it

  • timeout ( Duration ) – how long to wait for it to end

Raises

0 declared, 0 inherited

Esc

Type to search.