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
- Enter-TmuxSession [-Session] <Lib
Tmux > [-Read.Session Only ] [-WhatIf ] [-Confirm] [<CommonParameters >] -
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 refreshedSession. 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
CommandTimeoutbounds the entire attachment. Its initial acknowledgement has a five-second ceiling, shortened byCommandTimeout; a nullCommandTimeoutpermits 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.WhatIfemits 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.SessionAttachFailedretains 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
-WhatIfand-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 -WhatIfExample 2 Observe the selected session from your foreground terminal without sending pane input. Detach to receive the refreshed
Session. View sourceTerminal window $session | LibTmux\Enter-TmuxSession -ReadOnly- Parameters
-
-
The native session to enter. Its endpoint and generation are retained.
- Required
- Yes
- Position
- 0
- Pipeline input
- By value
- Validation
ValidateNotNull()
-
-ReadOnly(System.Management ) #.Automation .Switch Parameter Attach without permitting pane input.
- Required
- No
- Position
- Named
- Pipeline input
- No
- Switch
- Yes
-
-WhatIf(System.Management ) #.Automation .Switch Parameter Describe the attachment without executing it.
- Required
- No
- Position
- Named
- Pipeline input
- No
- Switch
- Yes
- Aliases
wi
-
-Confirm(System.Management ) #.Automation .Switch Parameter Prompt before attaching the terminal.
- 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.
-
-Verbose(System.Management ) #.Automation .Switch Parameter Display verbose messages produced by this command.
Aliases:vbMicrosoft Learn reference -
-Debug(System.Management ) #.Automation .Switch Parameter Display debug messages produced by this command.
Aliases:dbMicrosoft Learn reference -
-ErrorAction(System.Management ) #.Automation .Action Preference Choose how this command responds to non-terminating errors.
Aliases:eaMicrosoft Learn reference -
-WarningAction(System.Management ) #.Automation .Action Preference Choose how this command responds to warning messages.
Aliases:waMicrosoft Learn reference -
-InformationAction(System.Management ) #.Automation .Action Preference Choose how this command handles information messages.
Aliases:infaMicrosoft Learn reference -
-ProgressAction(System.Management ) #.Automation .Action Preference Choose how this command handles progress updates.
Aliases:progaMicrosoft Learn reference -
-ErrorVariable(System.String ) #Store the command's error records in the named variable.
Aliases:evMicrosoft Learn reference -
-WarningVariable(System.String ) #Store the command's warning records in the named variable.
Aliases:wvMicrosoft Learn reference -
-InformationVariable(System.String ) #Store the command's information records in the named variable.
Aliases:ivMicrosoft Learn reference -
-OutVariable(System.String ) #Save output in the named variable while passing it down the pipeline.
Aliases:ovMicrosoft Learn reference -
Buffer output before passing it to the next pipeline command.
Aliases:obMicrosoft Learn reference -
-PipelineVariable(System.String ) #Make the most recent output object available through a named variable within the pipeline.
Aliases:pvMicrosoft Learn reference
-
- Returns
-
LibTmux.Session:Onerefreshed native session after successful detach. Empty input emits nothing.
Discussed in Getting started · Workspace guide