# session.Session.fromEnv

- **Module:** session.Session
- **Package:** @libtmux/libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/2cb93308200da38a26b59876618116850f110607/packages/libtmux/src/session.ts#L365
- **Page:** https://libtmux.org/reference/ts/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;
```
