We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
TempDir
1 parent df368ae commit 84c0c9dCopy full SHA for 84c0c9d
library/std/src/sys_common/io.rs
@@ -8,6 +8,7 @@ pub mod test {
8
use crate::env;
9
use crate::fs;
10
use crate::path::{Path, PathBuf};
11
+ use crate::thread;
12
use rand::RngCore;
13
14
pub struct TempDir(PathBuf);
@@ -29,7 +30,12 @@ pub mod test {
29
30
// Gee, seeing how we're testing the fs module I sure hope that we
31
// at least implement this correctly!
32
let TempDir(ref p) = *self;
- fs::remove_dir_all(p).unwrap();
33
+ let result = fs::remove_dir_all(p);
34
+ // Avoid panicking while panicking as this causes the process to
35
+ // immediately abort, without displaying test results.
36
+ if !thread::panicking() {
37
+ result.unwrap();
38
+ }
39
}
40
41
0 commit comments