(cmd: &str, args: &[&str])
| 548 | } |
| 549 | |
| 550 | fn run_cmd(cmd: &str, args: &[&str]) -> Result<(), String> { |
| 551 | let output = StdCommand::new(cmd) |
| 552 | .args(args) |
| 553 | .stdin(Stdio::null()) |
| 554 | .stdout(Stdio::piped()) |
| 555 | .stderr(Stdio::piped()) |
| 556 | .output() |
| 557 | .map_err(|e| format!("failed to run {cmd}: {e}"))?; |
| 558 | if output.status.success() { |
| 559 | Ok(()) |
| 560 | } else { |
| 561 | let stderr = String::from_utf8_lossy(&output.stderr); |
| 562 | Err(format!("{cmd} {} failed: {stderr}", args.join(" "))) |
| 563 | } |
| 564 | } |
| 565 | |
| 566 | fn run_nft_stdin(ruleset: &str) -> Result<(), String> { |
| 567 | use std::io::Write; |
no test coverage detected