MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / with_isolated_cli_env

Function with_isolated_cli_env

crates/openshell-cli/src/completers.rs:162–174  ·  view source on GitHub ↗
(tmp: &std::path::Path, f: F)

Source from the content-addressed store, hash-verified

160 use temp_env::with_vars;
161
162 fn with_isolated_cli_env<F: FnOnce()>(tmp: &std::path::Path, f: F) {
163 let _guard = TEST_ENV_LOCK
164 .lock()
165 .unwrap_or_else(std::sync::PoisonError::into_inner);
166 let tmp = tmp.to_string_lossy().into_owned();
167 with_vars(
168 [
169 ("XDG_CONFIG_HOME", Some(tmp.as_str())),
170 ("OPENSHELL_GATEWAY", None::<&str>),
171 ],
172 f,
173 );
174 }
175
176 #[test]
177 fn gateway_completer_returns_empty_when_no_config() {

Calls 1

as_strMethod · 0.45