Skip to content

Instantly share code, notes, and snippets.

@mr-pascal
Last active June 29, 2022 19:41
Show Gist options
  • Save mr-pascal/6519404d8f0be17661b2961696a23436 to your computer and use it in GitHub Desktop.
Save mr-pascal/6519404d8f0be17661b2961696a23436 to your computer and use it in GitHub Desktop.
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