# libtmux::Server::from_env

- **Module:** libtmux::Server
- **Package:** libtmux-cxx
- **Language:** C++
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-cxx/blob/393d4b0ad666f18a6581f1eb281741a75a7503f0/include/libtmux/server.hpp#L141
- **Page:** https://libtmux.org/en/cxx/latest/reference/libtmux-server-from_env/

```
libtmux::Server::from_env(observer: CommandObserver = {}, policy: ExecutionPolicy = {}) -> expected< Server, CommandFailure >
```

The server this process is running inside.

tmux exports `TMUX` to everything it starts, as `<socket path>,<server pid>,<session id>`. Only the socket path is read: the session id is stale the moment a pane moves, and a `#()` job carries no session at all — so a caller who wants the session asks tmux, rather than trusting what it inherited.
