use bare_script::sync::Pipeline;
use thiserror as _;
use tokio as _;
fn main() -> Result<(), bare_script::ScriptError> {
#[cfg(windows)]
let output = {
Pipeline::new("cmd")
.args(["/C", "echo hello world"])
.pipe("findstr")
.arg("hello")
.capture_output()
.execute()
};
#[cfg(not(windows))]
let output = {
Pipeline::new("echo")
.arg("hello world")
.pipe("grep")
.arg("hello")
.capture_output()
.execute()
};
let output = output?;
println!("Stdout: {}", output.stdout_str());
println!("Success: {}", output.success());
Ok(())
}