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.Enter-TmuxSession

LibTmux\Enter-TmuxSession LibTmux\Enter-TmuxSession

Attach your foreground terminal to a selected session.

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

Description#

Attach a foreground tmux client using the endpoint and daemon generation of the supplied native Session . The command waits until you detach, then returns one refreshed Session . It does not detach other clients or choose a session from ambient tmux variables.

Run it in a foreground terminal outside tmux. Redirected stdin and a nonempty TMUX environment variable are rejected. These checks do not establish whether an arbitrary PowerShell host or in-process background runspace owns the terminal. Background jobs, remoting and custom hosts are not a supported attachment workflow.

ReadOnly prevents the client from sending pane input. Detach normally with your tmux detach key binding. Stopping the PowerShell pipeline cancels its owned attachment client; the borrowed session, daemon and other clients remain. Cancellation does not undo a workspace already applied.

The session's connection CommandTimeout bounds the entire attachment. Its initial acknowledgement has a five-second ceiling, shortened by CommandTimeout ; a null CommandTimeout permits an indefinite interactive lifetime afterward. A successful detach can still report a native readback failure if the session or daemon disappears before the refreshed handle is captured.

WhatIf emits no success object and performs no attachment, refresh or host application notification. Each actual input session is entered sequentially; prefer selecting exactly one session before invoking the command.

Notes

Requires PowerShell 7.4 or later on Linux or macOS with native tmux and a foreground terminal. Tmux.SessionAttachFailed retains the native exception and input session. When attachment and host restoration both fail, both causes are retained together.

Command details#

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

Examples#

Example 1 Preview attachment to a previously selected native session. No terminal is required for the preview. View source

Terminal window
$session | LibTmux\Enter-TmuxSession -WhatIf

Example 2 Observe the selected session from your foreground terminal without sending pane input. Detach to receive the refreshed Session . View source

Terminal window
$session | LibTmux\Enter-TmuxSession -ReadOnly
Parameters
Common parameters 12

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

Returns

LibTmux.Session : One refreshed native session after successful detach. Empty input emits nothing.

Discussed in Getting started · Workspace guide

Esc

Type to search.

Reference preview Open reference