Server.GetPaneAsync
Reads one pane by identifier, throwing when it is absent.
Source and package
- Qualified name
-
LibTmux .Server. Get Pane Async - Namespace
- LibTmux
- Declared in
Server- Package
- LibTmux
- Source
- src/LibTmux/Server.Identity.cs
- async Task<Pane> GetPaneAsync( Pane
Id id, CancellationToken cancellationToken = default ) -
- Parameters
-
-
cancellationToken(CancellationToken ) – Cancels the tmux command.Default
default
- Returns
-
A materialized pane carrying captured scalar state.
- Errors
-
-
Tmux
Object – The pane does not exist.Not Found Exception -
Lib
Tmux – The lookup failed, including an absent daemon.Exception
-
Examples
Use typed required lookups, nullable absence and explicit errors. Cancellation, invalid input and a stopped server remain exceptions. Use Linux or macOS with tmux 3.3a or newer, the .NET 10 SDK or newer, and the .NET 8 and 10 runtimes. In an empty directory, save this project as
Example.csproj. It references the 0.1.1 release ofLibTmuxon NuGet: View sourceExample.csproj <Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><OutputType>Exe</OutputType><TargetFrameworks>net8.0;net10.0</TargetFrameworks><LangVersion>12.0</LangVersion><Nullable>enable</Nullable><ImplicitUsings>disable</ImplicitUsings><EnableDefaultCompileItems>false</EnableDefaultCompileItems><TreatWarningsAsErrors>true</TreatWarningsAsErrors><AnalysisLevel>10-recommended</AnalysisLevel></PropertyGroup><ItemGroup><Compile Include="Program.cs" /><PackageReference Include="LibTmux" Version="[0.1.1]" /></ItemGroup></Project>Save this complete program as
Program.cs. It creates a private server;await usingdisposes its owned scopes after success, cancellation or failure. The complete file contains explicit imports, a top-level async entry point and a cancellation deadline. View sourceProgram.csComplete program using System;using System.IO;using System.Linq;using System.Threading;using LibTmux;if (OperatingSystem.IsWindows()){throw new PlatformNotSupportedException("This example requires tmux on Linux or macOS.");}using CancellationTokenSource deadline = new(TimeSpan.FromSeconds(10));CancellationToken token = deadline.Token;string? testTmux = Environment.GetEnvironmentVariable("LIBTMUX_TEST_TMUX");string? configured = !string.IsNullOrWhiteSpace(testTmux)? testTmux: Environment.GetEnvironmentVariable("LIBTMUX_TMUX");string binary = string.IsNullOrWhiteSpace(configured) ? "tmux" : configured;using TemporaryDirectory socketRoot = new();ServerConnectionOptions options = new(){SocketPath = Path.Combine(socketRoot.FullName, "tmux.sock"),ConfigurationFile = "/dev/null",TmuxBinaryPath = binary,};Server stoppedServer;await using (OwnedServerScope owned = await Server.CreateOwnedAsync(options, token)){await using OwnedSessionScope session = await owned.Value.CreateOwnedSessionAsync(new NewSessionRequest { Name = "demo", Command = "/bin/cat" }, token);Server server = await Server.ConnectAsync(options, token);Session found = await server.GetSessionAsync(session.Value.Id, token);Window listedWindow = (await found.GetWindowsAsync(token)).Single();Window window = await server.GetWindowAsync(listedWindow.Id, token);Pane listedPane = (await window.GetPanesAsync(token)).Single();Pane pane = await server.GetPaneAsync(listedPane.Id, token);if (found.Id != session.Value.Id || pane.Id != listedPane.Id){throw new InvalidOperationException("Typed lookup returned an unexpected entity.");}SessionId missingId = new(int.MaxValue);Session? missing = await server.FindSessionAsync(missingId, token);if (missing is not null){throw new InvalidOperationException("The absent session unexpectedly exists.");}Console.WriteLine("A successful lookup can return null.");try{_ = await server.GetSessionAsync(missingId, token);throw new InvalidOperationException("GetSessionAsync must throw for an absent session.");}catch (TmuxObjectNotFoundException){Console.WriteLine("Required lookup reports TmuxObjectNotFoundException.");}using CancellationTokenSource cancelled = new();cancelled.Cancel();try{_ = await server.FindSessionAsync(session.Value.Id, cancelled.Token);throw new InvalidOperationException("Cancelled lookup must throw.");}catch (OperationCanceledException){Console.WriteLine("Cancellation remains OperationCanceledException.");}try{_ = await window.FindPaneAsync(" ", token);throw new InvalidOperationException("A blank pane target must be rejected.");}catch (ArgumentException){Console.WriteLine("A blank pane target remains ArgumentException.");}stoppedServer = server;}try{_ = await stoppedServer.FindSessionAsync(new SessionId(int.MaxValue), token);throw new InvalidOperationException("A failed read must not become null.");}catch (LibTmuxException){Console.WriteLine("A stopped server remains a LibTmuxException.");}internal sealed class TemporaryDirectory : IDisposable{private readonly DirectoryInfo _directory = Directory.CreateTempSubdirectory("libtmux-example-");public string FullName => _directory.FullName;public void Dispose() => _directory.Delete(recursive: true);}Build the project and run both supported frameworks. Each program checks its result and exits unsuccessfully after an unhandled error:
Terminal window $ dotnet build Example.csproj --configuration Release && \dotnet bin/Release/net8.0/Example.dll && \dotnet bin/Release/net10.0/Example.dllExpected program output from each framework:
A successful lookup can return null.Required lookup reports TmuxObjectNotFoundException.Cancellation remains OperationCanceledException.A blank pane target remains ArgumentException.A stopped server remains a LibTmuxException.
Recorded calls
source callsThe C# 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.Server.GetPaneAsync.
tmux command
task materialThe tmux commands behind GetPaneAsync.
tmux C API
task materialThe C declarations in tmux that implement these commands.
In other ports
task equivalence 7 other ports mappedSource-verified mappings for Look one pane up by target. A mapping says these APIs perform the same task. It does not say they share defaults, errors or completion: check each page.
| Port | API | Differs from C# |
|---|---|---|
| C# | Lib Reads one pane by identifier, throwing when it is absent. | This page |
| Ruby | Lib Behavior: Live handles. | None recorded in the model |
| Erlang | tmux Read fresh fields for a physical pane ID. Performs I/O and returns target_gone for a vanished pane. A captured PID remains an observation, not a live-process guarantee. | free function |
| Rust | server Find the pane with this id. | None recorded in the model |
| Go | tmux Pane performs a canonical live lookup of id using tmux's canonical session and returns a newly materialized record. It does not preserve a linked-session view; use Pane.ResolveWindow for that exact relationship. | None recorded in the model |
| C++ | libtmux:: | readonly |
| OCaml | Libtmux | free function Exact opaque-ID lookup in an existing snapshot, without I/O. |
| Perl | Lib pane_by_id('%3') returns a LibTmux::Pane or undef. The returned handle retains the captured graph after this wrapper goes out of scope. | on Snapshot |
no equivalent on Server
No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.
no equivalent on Server
no equivalent on Server
no equivalent on Server
No direct Raku mapping is recorded for this operation; consult the native API reference.
No equivalent is recorded in Lua, PowerShell, Julia, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.