Created
November 13, 2013 15:21
-
-
Save klutzy/7450792 to your computer and use it in GitHub Desktop.
cur dir race
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::os; | |
use std::io; | |
use std::io::fs; | |
fn main() { | |
let tmp_path = os::tmpdir(); | |
for i in range(0u, 20u) { | |
let path = tmp_path.join(i.to_str()); | |
do spawn { | |
io::result(|| fs::mkdir(&path, io::UserRWX)); | |
let _ret = os::change_dir(&path); | |
let cur = os::getcwd(); | |
if cur != path { | |
println!("expected {:s} but found {:s}", | |
path.as_str().unwrap(), cur.as_str().unwrap()); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment