forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fs::remove_dir_all: treat ENOENT as success
fixes rust-lang#127576
- Loading branch information
1 parent
c92a8e4
commit a696f34
Showing
2 changed files
with
84 additions
and
27 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use run_make_support::{run_in_tmpdir, fs_wrapper::{create_dir, write, remove_dir_all}}; | ||
use std::thread; | ||
use std::time::Duration; | ||
|
||
fn main() { | ||
run_in_tmpdir(|| { | ||
for i in 0..10 { | ||
create_dir("outer"); | ||
create_dir("outer/inner"); | ||
write("outer/inner.txt", b"sometext"); | ||
|
||
let t1 = thread::spawn(move || { | ||
thread::sleep(Duration::from_millis(i * 10)); | ||
remove_dir_all("outer") | ||
}); | ||
|
||
let t2 = thread::spawn(move || { | ||
remove_dir_all("outer") | ||
}); | ||
|
||
t1.join().unwrap(); | ||
t2.join().unwrap(); | ||
} | ||
}) | ||
} |