Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![allow(unused)]
- use std::io::{BufRead, BufReader};
- use std::process;
- fn main() {
- let mut child = process::Command::new("yes")
- .stdout(process::Stdio::piped())
- .spawn()
- .expect("Failed to exec");
- // ここでstdoutを何行かprintして
- let buf = BufReader::new(child.stdout.unwrap());
- buf.lines().take(10).for_each(|l| {println!("{:?}", l.unwrap())});
- // killしたい
- child.kill().unwrap();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement