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

Function ssh_base_command

crates/openshell-cli/src/ssh.rs:142–169  ·  view source on GitHub ↗
(proxy_command: &str)

Source from the content-addressed store, hash-verified

140}
141
142fn ssh_base_command(proxy_command: &str) -> Command {
143 // SSH log level follows the program's verbosity. main() maps the `-v`
144 // count to OPENSHELL_SSH_LOG_LEVEL; an explicit env-var override wins.
145 let ssh_log_level =
146 std::env::var("OPENSHELL_SSH_LOG_LEVEL").unwrap_or_else(|_| "ERROR".to_string());
147
148 let mut command = Command::new("ssh");
149 command
150 .arg("-o")
151 .arg(format!("ProxyCommand={proxy_command}"))
152 .arg("-o")
153 .arg("StrictHostKeyChecking=no")
154 .arg("-o")
155 .arg("UserKnownHostsFile=/dev/null")
156 .arg("-o")
157 .arg("GlobalKnownHostsFile=/dev/null")
158 .arg("-o")
159 .arg(format!("LogLevel={ssh_log_level}"))
160 // Detect a dead relay within ~45s. The relay rides on a TCP connection
161 // that the client has no way to observe silently dropping (gateway
162 // restart, supervisor restart, cluster failover), so fall back to
163 // SSH-level keepalives instead of hanging forever.
164 .arg("-o")
165 .arg("ServerAliveInterval=15")
166 .arg("-o")
167 .arg("ServerAliveCountMax=3");
168 command
169}
170
171#[cfg(unix)]
172const TRANSIENT_TTY_SIGNALS: &[Signal] = &[Signal::SIGINT, Signal::SIGQUIT, Signal::SIGTERM];

Callers 6

sandbox_forwardFunction · 0.85
sandbox_exec_with_modeFunction · 0.85
ssh_tar_uploadFunction · 0.85
ssh_run_capture_stdoutFunction · 0.85
stream_sandbox_tarFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected