use Strings and return tuple for wg_cmd

master
lalanza808 4 years ago
parent fe601bf09b
commit 2c066fc934

@ -1,18 +1,20 @@
use std::process::Command;
pub fn wg_cmd(args: &'static [&'static str]) -> String {
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
(output_str, resp_code)
}
pub fn sh_cmd(cmd: &'static str) -> String {
pub fn sh_cmd(cmd: String) -> String {
let output = Command::new("sh")
.arg("-c")
.arg(cmd)

Loading…
Cancel
Save