#!/usr/bin/env rust-script
use sh_exec::*;
fn main() {
trap_panics_and_errors!("18428-30925-25863", || {
let path="/etc";
exec!("17068-22053-696", true, "ls -d {path}")?;
println!("ls -d of / is {}", exec!("15911-12192-19189", false, "ls -d {}", "/")?);
println!("ls of /etc/hosts is {}", s!("15911-12192-19189", "ls {p}", p="/etc/hosts")?);
let output = exec!("28328-2323-44343", true, "bash -c 'echo Hello World'")?;
println!("Output: {}", output);
match exec!("28328-2323-3278", true, "nonexistent_command") {
Ok(output) => println!("Unexpected success: {}", output),
Err(e) => println!("Expected error: {}", e),
}
exec!( "28328-2323-333", true, "nonexistent_command arg1 arg2")?;
Ok::<(), Box<dyn Error>>(())
});
}