You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
643 B
Rust
28 lines
643 B
Rust
use std::process::Command;
|
|
|
|
|
|
pub fn wg_cmd(args: Vec<String>) -> (String, i32) {
|
|
let output = Command::new("./bin/wg_cmd")
|
|
.args(args)
|
|
.output()
|
|
.expect("failed to execute process");
|
|
let output_str = String::from_utf8(output.stdout)
|
|
.unwrap();
|
|
let resp_code = output.status.code()
|
|
.unwrap();
|
|
|
|
(output_str, resp_code)
|
|
}
|
|
|
|
pub fn sh_cmd(cmd: String) -> String {
|
|
let output = Command::new("sh")
|
|
.arg("-c")
|
|
.arg(cmd)
|
|
.output()
|
|
.expect("failed to execute process");
|
|
let output_str = String::from_utf8(output.stdout)
|
|
.unwrap();
|
|
|
|
output_str
|
|
}
|