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

Function sandbox_exec_with_mode

crates/openshell-cli/src/ssh.rs:524–566  ·  view source on GitHub ↗
(
    server: &str,
    name: &str,
    command: &[String],
    tty: bool,
    tls: &TlsOptions,
    replace_process: bool,
)

Source from the content-addressed store, hash-verified

522}
523
524async fn sandbox_exec_with_mode(
525 server: &str,
526 name: &str,
527 command: &[String],
528 tty: bool,
529 tls: &TlsOptions,
530 replace_process: bool,
531) -> Result<()> {
532 if command.is_empty() {
533 return Err(miette::miette!("no command provided"));
534 }
535
536 let session = ssh_session_config(server, name, tls).await?;
537 let mut ssh = ssh_base_command(&session.proxy_command);
538
539 if tty {
540 ssh.arg("-tt")
541 .arg("-o")
542 .arg("RequestTTY=force")
543 .arg("-o")
544 .arg("SetEnv=TERM=xterm-256color");
545 } else {
546 ssh.arg("-T").arg("-o").arg("RequestTTY=no");
547 }
548
549 let command_str = command
550 .iter()
551 .map(|arg| shell_escape(arg))
552 .collect::<Vec<_>>()
553 .join(" ");
554
555 ssh.arg("sandbox")
556 .arg(command_str)
557 .stdin(Stdio::inherit())
558 .stdout(Stdio::inherit())
559 .stderr(Stdio::inherit());
560
561 tokio::task::spawn_blocking(move || exec_or_wait(ssh, tty && replace_process))
562 .await
563 .into_diagnostic()??;
564
565 Ok(())
566}
567
568/// Execute a command in a sandbox via SSH.
569pub async fn sandbox_exec(

Callers 2

sandbox_execFunction · 0.85

Calls 5

ssh_session_configFunction · 0.85
ssh_base_commandFunction · 0.85
exec_or_waitFunction · 0.85
shell_escapeFunction · 0.50
is_emptyMethod · 0.45

Tested by

no test coverage detected