MCPcopy Create free account
hub / github.com/SamSaffron/op-cache / exec_command

Function exec_command

src/run.rs:86–96  ·  view source on GitHub ↗

Replace the current process with the given command and environment. This function does not return on success.

(program: &str, args: &[String], env: &[(String, String)])

Source from the content-addressed store, hash-verified

84/// Replace the current process with the given command and environment.
85/// This function does not return on success.
86pub fn exec_command(program: &str, args: &[String], env: &[(String, String)]) -> Result<()> {
87 let mut cmd = Command::new(program);
88 cmd.args(args);
89 cmd.env_clear();
90 for (k, v) in env {
91 cmd.env(k, v);
92 }
93 // exec replaces the process; if it returns, something went wrong
94 let err = cmd.exec();
95 bail!("exec failed: {}", err)
96}
97
98#[cfg(test)]
99mod tests {

Callers 1

cmd_runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected