Skip to content

Instantly share code, notes, and snippets.

@tlkahn
Created December 7, 2021 14:37
Show Gist options
  • Save tlkahn/a28c7a44679f81c0df360fc8ec2e6c91 to your computer and use it in GitHub Desktop.
Save tlkahn/a28c7a44679f81c0df360fc8ec2e6c91 to your computer and use it in GitHub Desktop.
use std::process::Command;
use std::process::Stdio;
fn main() {
println!("Hello, world!");
let output = Command::new("ls")
.arg("-l")
.arg("-a")
.stdout(Stdio::piped())
.output()
.expect("ls command failed to start");
println!("{}", String::from_utf8_lossy(&output.stdout))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment