File tree 1 file changed +1
-47
lines changed
1 file changed +1
-47
lines changed Original file line number Diff line number Diff line change @@ -35,53 +35,7 @@ function rimrafSync(pathname, { spawn = true } = {}) {
35
35
}
36
36
}
37
37
38
- try {
39
- if ( st . isDirectory ( ) )
40
- rmdirSync ( pathname , null ) ;
41
- else
42
- fs . unlinkSync ( pathname ) ;
43
- } catch ( e ) {
44
- debug ( e ) ;
45
- switch ( e . code ) {
46
- case 'ENOENT' :
47
- // It's not there anymore. Work is done. Exiting.
48
- return ;
49
-
50
- case 'EPERM' :
51
- // This can happen, try again with `rmdirSync`.
52
- break ;
53
-
54
- case 'EISDIR' :
55
- // Got 'EISDIR' even after testing `st.isDirectory()`...
56
- // Try again with `rmdirSync`.
57
- break ;
58
-
59
- default :
60
- throw e ;
61
- }
62
- rmdirSync ( pathname , e ) ;
63
- }
64
- }
65
-
66
- function rmdirSync ( p , originalEr ) {
67
- try {
68
- fs . rmdirSync ( p ) ;
69
- } catch ( e ) {
70
- if ( e . code === 'ENOTDIR' )
71
- throw originalEr ;
72
- if ( e . code === 'ENOTEMPTY' || e . code === 'EEXIST' || e . code === 'EPERM' ) {
73
- const enc = process . platform === 'linux' ? 'buffer' : 'utf8' ;
74
- fs . readdirSync ( p , enc ) . forEach ( ( f ) => {
75
- if ( f instanceof Buffer ) {
76
- const buf = Buffer . concat ( [ Buffer . from ( p ) , Buffer . from ( path . sep ) , f ] ) ;
77
- rimrafSync ( buf ) ;
78
- } else {
79
- rimrafSync ( path . join ( p , f ) ) ;
80
- }
81
- } ) ;
82
- fs . rmdirSync ( p ) ;
83
- }
84
- }
38
+ fs . rmdirSync ( pathname , { recursive : true , maxRetries : 5 } ) ;
85
39
}
86
40
87
41
const testRoot = process . env . NODE_TEST_DIR ?
You can’t perform that action at this time.
0 commit comments