# LibTmux.Session.FromEnvironmentAsync

- **Module:** LibTmux.Session
- **Package:** LibTmux
- **Language:** .NET
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-dotnet/blob/6656a563ec9e07ab52e0c3ac96f7704fc94cc0c0/src/LibTmux/Session.FromEnvironment.cs#L17
- **Page:** https://libtmux.org/reference/dotnet/libtmux-session-fromenvironmentasync/

```
LibTmux.Session.FromEnvironmentAsync(environment: IReadOnlyDictionary<string, string>?, cancellationToken: CancellationToken) -> Task<Session>
```

Returns the session holding the pane this process runs in.

Resolved through the pane rather than through the session id in
<c>TMUX</c>. That id is frozen at pane spawn, so it names the wrong
session once the pane's window is moved or linked elsewhere.

## Parameters

- `environment` (IReadOnlyDictionary<string, string>?) — The environment, or null for the process.
- `cancellationToken` (CancellationToken) — Cancels the tmux commands.

## Returns

The resolved session.
