# LibTmux.Server.FromEnvironment

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** C#
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-dotnet/blob/cf34b255c896d19a97e7d7fabea58609c916012d/src/LibTmux/Server.FromEnvironment.cs#L21
- **Page:** https://libtmux.org/en/csharp/latest/reference/libtmux-server-fromenvironment/

```
LibTmux.Server.FromEnvironment(environment: IReadOnlyDictionary<string, string>?) -> Server
```

Returns the server whose pane this process was spawned in.

Only the socket path is used. The pid and session id in <c>TMUX</c> are
frozen at pane spawn, and the session id goes stale as soon as the
pane's window moves between sessions. Costs no tmux subprocess.

## Parameters

- `environment` (`IReadOnlyDictionary<string, string>?`): The environment, or null for the process.

## Returns

An unmaterialized handle for the exported socket.

## Raises

- [`TmuxObjectNotFoundException`](/en/csharp/latest/reference/libtmux-tmuxobjectnotfoundexception/): The environment does not name a tmux server.
