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

Function apply_child_env

crates/openshell-supervisor-process/src/ssh.rs:692–736  ·  view source on GitHub ↗
(
    cmd: &mut Command,
    session_home: &str,
    session_user: &str,
    term: &str,
    proxy_url: Option<&str>,
    ca_file_paths: Option<&(PathBuf, PathBuf)>,
    provider_env: &HashMap<String,

Source from the content-addressed store, hash-verified

690
691#[allow(clippy::too_many_arguments)]
692fn apply_child_env(
693 cmd: &mut Command,
694 session_home: &str,
695 session_user: &str,
696 term: &str,
697 proxy_url: Option<&str>,
698 ca_file_paths: Option<&(PathBuf, PathBuf)>,
699 provider_env: &HashMap<String, String>,
700 user_environment: &HashMap<String, String>,
701) {
702 let path = std::env::var("PATH").unwrap_or_else(|_| "/usr/local/bin:/usr/bin:/bin".into());
703
704 cmd.env_clear()
705 .env(openshell_core::sandbox_env::SANDBOX, "1")
706 .env("HOME", session_home)
707 .env("USER", session_user)
708 .env("SHELL", "/bin/bash")
709 .env("PATH", &path)
710 .env("TERM", term);
711
712 for (key, value) in user_environment {
713 if !key.starts_with("OPENSHELL_") {
714 cmd.env(key, value);
715 }
716 }
717
718 if let Some(url) = proxy_url {
719 for (key, value) in child_env::proxy_env_vars(url) {
720 cmd.env(key, value);
721 }
722 }
723
724 if let Some((ca_cert_path, combined_bundle_path)) = ca_file_paths {
725 for (key, value) in child_env::tls_env_vars(ca_cert_path, combined_bundle_path) {
726 cmd.env(key, value);
727 }
728 }
729
730 for (key, value) in provider_env {
731 if is_supervisor_only_env_var(key) {
732 continue;
733 }
734 cmd.env(key, value);
735 }
736}
737
738#[allow(clippy::too_many_arguments)]
739fn spawn_pty_shell(

Callers 2

spawn_pty_shellFunction · 0.85
spawn_pipe_execFunction · 0.85

Calls 3

proxy_env_varsFunction · 0.85
tls_env_varsFunction · 0.85

Tested by

no test coverage detected