Core Library0.xAPI Reference

Choose documentation 2

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.

cmdlet libtmux-powershell latest

LibTmux.Invoke-TmuxControlCommand

Run a native command on a borrowed control client.

Source and package
Qualified name
LibTmux\Invoke-TmuxControlCommand
Declared in
LibTmux
Package
LibTmux
Source
src/LibTmux.PowerShell/InvokeTmuxControlCommandCommand.cs

Description#

Send one native command and emit its reply lines as strings. Commands with no reply emit no success object. Native commands retain their generation and placement guards; raw commands use tmux target resolution.

Concurrent callers receive their correlated replies from the core. Cancelling stops this caller waiting, not a command already sent, and does not dispose the borrowed client. A later send remains usable after the cancelled command finishes. WhatIf sends nothing; an empty connection pipeline performs no work.

Literal commands that an optional feature cannot run safely on the daemon's tmux release are refused before the requested command is dispatched. A command that needs another release raises LibTmux.TmuxVersionTooLowException. A session or window name that exactly tmux 3.7 rejects raises LibTmux.TmuxUnsupportedOnReleaseException, the type that TmuxVersionTooLowException derives from, so one catch of it covers every refusal. Only the command given is checked. A refused command carried inside another command's text is not: an if-shell or run-shell -C string, bind-key, set-hook, confirm-before, a menu, a prompt or choose template, or a brace block. Nested, it reaches tmux unchanged. A nameless break-pane ends a tmux 3.7 server, so on exactly 3.7 name every break-pane, including the one prefix ! runs, or upgrade to 3.7a. The other failures are listed at https://libtmux.org/en/powershell/latest/guides/compatibility/#what-the-checks-do-not-read

Notes

Tmux.InvalidCommand rejects a global option in the command-name position before dispatch. Tmux.ControlCommandFailed retains native exceptions and the connection target. ErrorAction Continue permits later clients to run. The core bounds pending requests and replies; rejected admission does not retry. Confirmation identifies the supplied connection without inventing endpoint metadata absent from IControlModeSession.

Command details#

Command type
cmdlet
Confirmation
Supports -WhatIf and -Confirm; confirm impact: Medium.
Positional binding
Enabled.
Pipeline inputs
LibTmux.IControlModeSession: The borrowed client to send through.
Outputs
System.String

Examples#

Example 1 Print the attached session name using an existing $control owned by your surrounding try/finally scope. View source

Terminal window
$command = LibTmux\New-TmuxCommand -Name 'display-message' -Arguments @(
'-p', '#{session_name}'
)
$control | LibTmux\Invoke-TmuxControlCommand -Command $command
Parameters
Common parameters 12

PowerShell supplies these parameters. See common parameter behavior for their effects.

Returns

System.String: Native reply lines, in reply order.

Guides#

Pages that discuss Invoke-TmuxControlCommand.

Esc

Type to search.

Reference previewOpen reference