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.

method libtmux-go latest

Server.RunShell

RunShell executes a shell command through tmux and returns an owned stdout slice. Captured foreground shell jobs require tmux 3.5 before execution; older releases deliver that output to no client. A background request returns nil after tmux accepts the job. TargetPane delivers output to that pane on older supported daemons. AsTmuxCommand uses native tmux command semantics rather than promising captured shell-job output. Unsupported optional flags follow UnsupportedPolicy. A completed stderr result is an error; context cancellation can be observed with errors.Is but does not establish that tmux did not start the job.

Source and package
Qualified name
tmux.Server.RunShell
Package
tmux
Declared in
Server
Distribution
github.com/libtmux/libtmux-go/tmux
Source
tmux/server_exec.go
Other languages
Perl Erlang PowerShell Julia Elixir Haskell Common Lisp PythonRuby Lua TypeScriptRustJavaC#C++ Swift Kotlin Scala OCaml F# Clojure

Description#

On a Connection-bound server a foreground request runs on a control client opened for that call and closed when it ends, as Server.WaitFor does, so a slow or canceled command leaves every lane free. tmux sends that client the command's output as lines outside any reply frame, so the client takes every line before its own fence as output, whatever the line looks like. The one exception is a line that is a well-formed control notification, such as "%window-add @1", which a connection cannot tell from tmux's own and drops.

A foreground command that tmux ends with success is checked against the server, as in Server.WaitFor, and returns an error matching ErrNoServer when the server exited under it.

tmux command#

The tmux commands behind RunShell.

tmux C API#

The C declarations in tmux that implement these commands.

In other ports#

Run a shell command through tmux

Equivalents of Run a shell command through tmux in other languages
Language Equivalent
Python libtmux.Server.run_shell
Ruby LibTmux::Server#run
Haskell No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.
TypeScript server.Server.runShell
Rust server.Server.run_shell
Java io.github.libtmux.Shell.run
C# LibTmux.Server.RunShellAsync
C++ libtmux::Server::run_shell
Swift Server.run(_:in:) types a command into a pane rather than running it on the host
OCaml No direct public OCaml equivalent is recorded for this operation.
Perl No dedicated equivalent in the selected Perl surface. Explicit Server::cmd remains available for native tmux commands.

No equivalent is recorded in Lua, PowerShell, Julia, Erlang, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.

Esc

Type to search.

Reference previewOpen reference