Outstanding! #DeskChecking cargo run Compiling life v0.1.0 (/home/alone/life) Finished dev [unoptimized + debuginfo] target(s) in 0.35s Running `/home/alone/life/target/debug/life` Was execution successful? true use std::process::Command; use std::process::Output; use std::error::Error; fn main() { let mut p1: Command = Command::new("which"); p1.arg("python3"); let proc_result: Result = p1.output().map_err(|e| e.into()); if proc_result.is_ok() { let result: Output = proc_result.unwrap(); println!("Was execution successful? {}", result.status.success()); if !result.status.success() { println!("Error occurred: {}", result.status.code().unwrap()); } } }
Please help support more videos by shopping on my Amazon storefront! 📦 www.amazon.com/shop/trevorsullivan
Love your videos. I just started making Rust videos a while back, your videos really help.
Clear and consice , thank you so much i learnt a lot
I'm so happy to hear that! Thank you for letting me know. Keep on learning and practicing Rust!
head reads lines and is waiting for input to end because "inputtwo" is not line-terminated -> "inputone
inputtwo
" should do
nice vid
Outstanding! #DeskChecking
cargo run
Compiling life v0.1.0 (/home/alone/life)
Finished dev [unoptimized + debuginfo] target(s) in 0.35s
Running `/home/alone/life/target/debug/life`
Was execution successful? true
use std::process::Command;
use std::process::Output;
use std::error::Error;
fn main() {
let mut p1: Command = Command::new("which");
p1.arg("python3");
let proc_result: Result = p1.output().map_err(|e| e.into());
if proc_result.is_ok() {
let result: Output = proc_result.unwrap();
println!("Was execution successful? {}", result.status.success());
if !result.status.success() {
println!("Error occurred: {}", result.status.code().unwrap());
}
}
}