use bare_script::proc::CommandBuilder;
use thiserror as _;
#[tokio::main]
async fn main() -> Result<(), bare_script::ScriptError> {
#[cfg(windows)]
let output = {
CommandBuilder::new("cmd")
.args(["/C", "echo Hello async!"])
.capture_output()
.execute()
.await
};
#[cfg(not(windows))]
let output = {
CommandBuilder::new("echo")
.arg("Hello async!")
.capture_output()
.execute()
.await
};
let output = output?;
println!("Exit code: {:?}", output.code());
println!("Stdout: {}", output.stdout_str());
println!("Success: {}", output.success());
Ok(())
}