Skip to content

Instantly share code, notes, and snippets.

@fbernier
Last active September 6, 2018 01:23
Show Gist options
  • Save fbernier/0581ae7ee65204e0f66862ce6d7df50b to your computer and use it in GitHub Desktop.
Save fbernier/0581ae7ee65204e0f66862ce6d7df50b to your computer and use it in GitHub Desktop.
use std::process::{Command};
fn main() {
let output = Command::new("curl").arg("-s").arg("http://ovh.net/files/100Mio.dat").output();
println!("{:?}", output.unwrap().stdout.len());
}
~/stuff ❯❯❯ time ./dwl
104857600
./dwl 16.22s user 1.80s system 23% cpu 1:15.24 total
use std::process::{Command, Stdio};
fn main() {
let child = Command::new("curl").arg("-s").arg("http://ovh.net/files/100Mio.dat").stdout(Stdio::piped()).spawn();
let output = child.unwrap().wait_with_output().unwrap();
println!("{:?}", output.stdout.len());
}
~/stuff ❯❯❯ time ./dwl2
104857600
./dwl2 0.64s user 2.18s system 5% cpu 53.072 total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment