# session.settings.Session.hide_environment

- **Module:** session.settings.Session
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/8a648c0894dfffc9303583f753b6c8ae01f2fe76/crates/libtmux/src/session/settings.rs#L462
- **Page:** https://libtmux.org/reference/rs/session-settings-session-hide_environment/

```
session.settings.Session.hide_environment(self, name: &str) -> Result<(), Error>
```

Hide a variable from processes started in this session.

Different from [`Self::unset_environment`], which deletes the session's
own entry and lets whatever tmux inherited show through. This keeps an
entry and marks it, so a process started here is handed an environment
with the name *absent* even though the tmux server has one. It is what
[`EnvironmentEntry::Removed`] reports.

# Errors

Returns an error when tmux rejects the name.

## Example

```rust
use libtmux::EnvironmentEntry;

let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("hidden").await?;

session.hide_environment("PAGER").await?;
assert_eq!(
    session.environment_all().await?.get("PAGER"),
    Some(&EnvironmentEntry::Removed),
);

guard.shutdown().await?;
```
