Created
April 5, 2015 15:16
-
-
Save hunterboerner/5ed2930c63046e98703b to your computer and use it in GitHub Desktop.
Spawn a command in Rust with separate STDIO and then print it out to the main thread's STDOUT (or whatever buffer you want).
This file contains hidden or 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
let process = Command::new("randomstrings").stdin(Stdio::piped()).stdout(Stdio::piped()).spawn().unwrap(); | |
let mut thing = process.stdout.unwrap(); | |
loop { | |
let something: &mut [u8] = &mut [0]; | |
thing.read(something); | |
print!("{}", std::str::from_utf8(something).unwrap()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment