Last active
June 29, 2022 19:41
-
-
Save mr-pascal/6519404d8f0be17661b2961696a23436 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::process::Command; | |
use std::str; | |
fn main() { | |
// output() | |
let out2 = Command::new("ls") | |
.arg("-l") | |
.arg("-a") | |
.output() | |
.expect("ls command failed to start"); | |
// Convert `stdout` to a string slice and print it | |
let s = str::from_utf8(&out2.stdout).unwrap(); | |
println!("\nstdout:\n{}", s); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment