Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

server.Server.setEnvironment

TypeScript

View as Markdown

Module
server
Declared in
Server
Package
libtmux
Source
packages/libtmux/src/server.ts
Other languages
PythonRubyLuaRustGo Java .NET C++ Swift
setEnvironment ( name : : string , value : : string , options : : SetEnvironmentOptions ) → Promise<void>
method [source]
method [source]
setEnvironment

Set a variable in the server's global environment.

Discussed in Environment

In other ports Set a variable in the server's environment

Examples

await server.setEnvironment("EDITOR", "vim");
use libtmux::EnvironmentEntry;
let guard = libtmux::test::TestServer::new().await?;
let server = guard.server();
server.set_environment("EDITOR", "hx").await?;
assert!(matches!(
server.environment("EDITOR").await?,
Some(EnvironmentEntry::Set(value)) if value.as_bytes() == b"hx",
));
// Separate stores: the session has no entry of its own, and reading it
// does not fall back to the server. The value still reaches a process
// the session starts.
let session = server.new_session("separate").await?;
assert_eq!(session.environment("EDITOR").await?, None);
guard.shutdown().await?;

0 declared, 0 inherited

Esc

Type to search.