8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
- use std:: path:: BytesContainer ;
12
11
use std:: io:: { Command , fs, USER_RWX } ;
13
12
use std:: os;
13
+ use std:: path:: BytesContainer ;
14
+ use std:: rand:: random;
14
15
15
16
fn main ( ) {
16
17
// If we're the child, make sure we were invoked correctly
@@ -28,8 +29,10 @@ fn test() {
28
29
let my_path = os:: self_exe_name ( ) . unwrap ( ) ;
29
30
let my_dir = my_path. dir_path ( ) ;
30
31
31
- let child_dir = Path :: new ( my_dir. join ( "issue-15149-child" ) ) ;
32
- drop ( fs:: mkdir ( & child_dir, USER_RWX ) ) ;
32
+ let random_u32: u32 = random ( ) ;
33
+ let child_dir = Path :: new ( my_dir. join ( format ! ( "issue-15149-child-{}" ,
34
+ random_u32) ) ) ;
35
+ fs:: mkdir ( & child_dir, USER_RWX ) . unwrap ( ) ;
33
36
34
37
let child_path = child_dir. join ( format ! ( "mytest{}" ,
35
38
os:: consts:: EXE_SUFFIX ) ) ;
@@ -48,4 +51,7 @@ fn test() {
48
51
format!( "child assertion failed\n child stdout:\n {}\n child stderr:\n {}" ,
49
52
child_output. output. container_as_str( ) . unwrap( ) ,
50
53
child_output. error. container_as_str( ) . unwrap( ) ) ) ;
54
+
55
+ fs:: rmdir_recursive ( & child_dir) . unwrap ( ) ;
56
+
51
57
}
0 commit comments