Core LibraryAPI Reference

Choose documentation 2

latest

Current version

latest
English

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

cmdlet libtmux-powershell latest

LibTmux.Invoke-TmuxPaneCommand

LibTmux\Invoke-TmuxPaneCommand LibTmux\Invoke-TmuxPaneCommand

Run a shell command in a native pane and report its exit status.

Source and package
Declared in
LibTmux
Package
LibTmux
Source
src/LibTmux.PowerShell/InvokeTmuxPaneCommandCommand.cs

Description#

Run Command in a subshell in the selected pane and return a native LibTmux.PaneRunResult . The result records the pane ID, authenticated shell exit status, whether the wait timed out, elapsed time and effective timeout. A nonzero exit status is a result, not a cmdlet error. The command does not change the parent shell's working directory or environment.

A timeout returns TimedOut = True and a null ExitStatus ; the command may still be running. Cancellation after dispatch can leave it running too. Inspect the pane before retrying either case. Output contains bounded rendered command output, which may include stdout and stderr together. It is not a byte-exact process stream. Inspect LinesMissed, AnchorLost and omission counts before treating it as complete. Started = False means no start marker was confirmed; it does not prove the command never ran. The default view omits output text. Get-TmuxPaneContent reads the current screen separately.

The pane must be a live, writable POSIX-compatible shell. -WhatIf performs no tmux I/O or input operation. Confirmation identifies the endpoint and pane without displaying Command. A leading space is added to shell input by default; shells configured to ignore space-prefixed history entries may omit it from history. This is best effort.

Notes

Tmux.PaneCommandFailed retains the pane as its target. The core reserves one active command per pane in this process. A timed-out run keeps its reservation until completion or an authenticated pane/server end; a second run is refused while that command may still be active. A borrowed server is never removed.

Command details#

Command type
cmdlet
Confirmation
Supports -WhatIf and -Confirm ; confirm impact: Medium.
Positional binding
Enabled.
Pipeline inputs
LibTmux.Pane : The native pane selected from an explicit endpoint.
Outputs
LibTmux.PaneRunResult

Examples#

Example 1 Given a native $pane running /bin/sh on an endpoint you own, inspect a nonzero status without treating it as an operation failure: View source

Terminal window
$pane |
LibTmux\Invoke-TmuxPaneCommand -Command 'exit 7' -Timeout 5 -Confirm:$false
The result has ExitStatus = 7 and TimedOut = False.
Parameters
  • -Pane (LibTmux.Pane) #

    The native pane from the endpoint you intend to change.

    Required
    Yes
    Position
    0
    Pipeline input
    By value
    Validation
    ValidateNotNull()
  • -Command (System.String) #

    The shell command to run in a subshell. Empty, whitespace-only and NUL-containing commands are rejected. The core accepts at most 64 KiB of UTF-8 input.

    Required
    Yes
    Position
    1
    Pipeline input
    No
    Validation
    ValidateNotNull()
  • -Timeout (System.Double) #

    The completion wait in seconds. Fractions are accepted. The default is 30; the valid range is 0.0000001 through 86400. NaN and infinity are rejected. Cleanup after an observed result may take additional time.

    Required
    No
    Position
    Named
    Pipeline input
    No
    Default
    30
  • -SuppressHistory (System.Boolean) #

    Add a leading space to the shell input. Defaults to True. Set to False to omit the prefix; shell history behavior still depends on the shell and its configuration.

    Required
    No
    Position
    Named
    Pipeline input
    No
    Default
    True
  • -WhatIf (System.Management.Automation.SwitchParameter) #

    Describe the intended command without sending it or acquiring fresh tmux state.

    Required
    No
    Position
    Named
    Pipeline input
    No
    Switch
    Yes
    Aliases
    wi
  • -Confirm (System.Management.Automation.SwitchParameter) #

    Prompt before sending the command. The prompt does not show Command.

    Required
    No
    Position
    Named
    Pipeline input
    No
    Switch
    Yes
    Aliases
    cf
Common parameters 12

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

Returns

LibTmux.PaneRunResult : One result per pane with exit status or a timeout indication.

Discussed in Check command completion · Getting started , Send input to a pane · Dispatch, completion, and failure

Esc

Type to search.

Reference preview Open reference