Created
September 5, 2015 13:20
-
-
Save raindev/d31939254581dc4abf90 to your computer and use it in GitHub Desktop.
A simple Rust program to demonstrate loss of cached stdout
This file contains 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
use std::fs; | |
use std::env; | |
use std::process; | |
fn main() { | |
match env::args_os().nth(1) { | |
None => { | |
print!("nope"); | |
print!("okay"); | |
// will cause losss of stdout buffered above | |
process::exit(1) | |
}, | |
Some(dir_name) => match fs::read_dir(dir_name) { | |
Ok(d) => println!("{}", d.count()), | |
Err(e) => println!("{}", e), | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment