Pane.from_env
Find the pane this process is running in.
Source and package
- Qualified name
-
libtmux::pane:: Pane:: from _env - Module
- pane
- Declared in
Pane- Package
- libtmux
- Source
- crates/libtmux/src/pane.rs
-
Description#
tmux sets
TMUX_PANEin every process it starts, so a program running inside a pane can locate itself without being told which one it is. Pair it withcrate::Server::from_env(), which reads the server from the same place.Ok(None)means tmux no longer has that pane, which is possible when the value came from an environment that outlived it.Errors
Returns an error when
TMUX_PANEis absent or is not a pane ID, or when the pane listing fails.Examples#
use libtmux::Pane;let session = server.new_session("locating").await?;let expected = session.panes().await?.remove(0);// Standing in for the environment tmux gives a process it starts.let found = Pane::from_env_value(server, Some(expected.id().as_ref())).await?;assert_eq!(found.expect("the pane exists").id(), expected.id());- Parameters
-
-
server(&crate::Server ) #
-
Guides#
Pages that discuss from_env.