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.

MoreLess about this notice

cmdlet libtmux-powershell

LibTmux.New-TmuxSession

Create a detached session on an explicit server.

Source and package
Qualified name
LibTmux\New-TmuxSession
Declared in
LibTmux
Package
LibTmux
Source
src/LibTmux.PowerShell/NewTmuxSessionCommand.cs

Description

Create a session and its initial window and pane, then return the captured native LibTmux.Session. The Server parameter accepts a native endpoint handle directly or through the pipeline. The core can start the daemon when that endpoint has no server. Existing session names remain errors; the command does not replace or attach to an existing session.

Notes

WhatIf reports the intended endpoint without discovery, daemon startup or dispatch, and returns no created object. Confirmation precedes the core operation. Success does not transfer ownership of the daemon to the module or arrange automatic cleanup. Cancellation can occur after a session was created; it is not rollback and the module does not retry. Per-owner errors use Tmux.SessionCreateFailed and retain the core exception and failed server. ErrorAction Continue allows later owners to run. A WindowName with a colon or a period on exactly tmux 3.7 reports LibTmux.TmuxUnsupportedOnReleaseException as its error before creating the session. A Name with either character is refused on every release with ArgumentException.

Command details

Command type
cmdlet
Confirmation
Supports -WhatIf and -Confirm; confirm impact: Medium.
Positional binding
Enabled.
Pipeline inputs
LibTmux.Server: Native pipeline type for this command.
Outputs
LibTmux.Session
Parameters
Common parameters 12

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

Returns

LibTmux.Session: Captured native object for the created resource.

Examples

Example 1 Create a detached session on the server identified by the absolute $SocketPath. Choose an endpoint you control; the created session remains running until you remove it. View source

Terminal window
$options = @{
Name = 'help-session'
WindowName = 'work'
Command = 'exec /bin/sh'
}
LibTmux\New-TmuxServer -SocketPath $SocketPath |
LibTmux\New-TmuxSession @options

Recorded calls

source calls
No call edges in the PowerShell model.

The PowerShell reference records declarations, not calls, so this page shows no callers or callees. That is a limit of the extracted data, not a statement that nothing calls LibTmux\New-TmuxSession.

tmux command

task material

The tmux commands behind New-TmuxSession.

tmux C API

task material

The C declarations in tmux that implement these commands.

Each path starts at a function a command runs, which is degree 1. The degree counts steps from there along the path, and each step is a call or a reference: degree 2 is reached from that function, degree 3 from the next, and so on.

Create a session and its first pane

  1. 1 cmd_new_session_exec
  2. calls → 2 spawn_window
  3. calls → 3 spawn_pane
  4. calls → 4 window_add_pane
  5. calls → 5 window_pane_create

Guides

task material

Pages that discuss New-TmuxSession.

Esc
Search in

Type to search.

Reference previewOpen reference