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

Function openshell_tty_cmd

e2e/rust/src/harness/binary.rs:64–85  ·  view source on GitHub ↗

Create a [`tokio::process::Command`] that runs `openshell` under a PTY.

(args: &[&str])

Source from the content-addressed store, hash-verified

62
63/// Create a [`tokio::process::Command`] that runs `openshell` under a PTY.
64pub fn openshell_tty_cmd(args: &[&str]) -> tokio::process::Command {
65 let bin = openshell_bin();
66 let mut cmd = tokio::process::Command::new("script");
67
68 if cfg!(target_os = "macos") {
69 cmd.arg("-q").arg("/dev/null").arg(bin).args(args);
70 } else {
71 let mut shell_command = shell_escape(bin.to_str().expect("openshell path is utf-8"));
72 for arg in args {
73 shell_command.push(' ');
74 shell_command.push_str(&shell_escape(arg));
75 }
76 cmd.arg("-q")
77 .arg("-e")
78 .arg("-c")
79 .arg(shell_command)
80 .arg("/dev/null");
81 }
82
83 cmd.kill_on_drop(true);
84 cmd
85}
86
87#[cfg(test)]
88mod tests {

Calls 3

openshell_binFunction · 0.85
pushMethod · 0.80
shell_escapeFunction · 0.70