# session.Session.set_environment

- **Module:** session.Session
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/f0e37052c232636b61d095817046e6bfc8f2ca40/crates/libtmux/src/session/settings.rs#L368
- **Page:** https://libtmux.org/en/rs/latest/reference/session-session-set_environment/

```
session.Session.set_environment(self, name: &str, value: impl Into<OsString>) -> Result<(), Error>
```

Set an environment variable for processes this session starts.

Existing panes keep the environment they were started with; this
affects what new panes inherit.

The value is marked sensitive, since an environment carries tokens.

# Errors

Returns an error when tmux rejects the name or value.
