# session.Session.fromEnv

- **Module:** session.Session
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/3fe1ca654b81b8cbf4a13b777a001a3298c87a6f/packages/libtmux/src/session.ts#L372
- **Page:** https://libtmux.org/en/ts/latest/reference/session-session-fromenv/

```
session.Session.fromEnv(environment: : Readonly<Record<string, string | undefined>> = process.env) -> Promise<Session>
```

Resolve the session this process is running inside.

The pane is authoritative: `$TMUX`'s exported session id goes stale when a
pane is moved, so the session is looked up through `$TMUX_PANE` instead.

## Example

```ts
const current = await Session.fromEnv();
current.name;
```
