File tree Expand file tree Collapse file tree 1 file changed +26
-12
lines changed
Expand file tree Collapse file tree 1 file changed +26
-12
lines changed Original file line number Diff line number Diff line change @@ -108,18 +108,32 @@ function refresh(opts = {}) {
108108 firstRefresh = false ;
109109 // Clean only when a test uses refresh. This allows for child processes to
110110 // use the tmpdir and only the parent will clean on exit.
111- process . on ( 'exit' , ( ) => {
112- try {
113- // Change dit to avoid possible EBUSY
114- if ( isMainThread )
115- process . chdir ( testRoot ) ;
116- rimrafSync ( tmpPath , { spawn : false } ) ;
117- } catch ( e ) {
118- console . error ( 'Can\'t clean tmpdir:' , tmpPath ) ;
119- console . error ( 'Files blocking:' , fs . readdirSync ( tmpPath ) ) ;
120- throw e ;
121- }
122- } ) ;
111+ process . on ( 'exit' , onexit ) ;
112+ }
113+ }
114+
115+ function onexit ( ) {
116+ // Change directory to avoid possible EBUSY
117+ if ( isMainThread )
118+ process . chdir ( testRoot ) ;
119+
120+ try {
121+ rimrafSync ( tmpPath , { spawn : false } ) ;
122+ } catch ( e ) {
123+ console . error ( 'Can\'t clean tmpdir:' , tmpPath ) ;
124+
125+ const files = fs . readdirSync ( tmpPath ) ;
126+ console . error ( 'Files blocking:' , files ) ;
127+
128+ if ( files . some ( ( f ) => f . startsWith ( '.nfs' ) ) ) {
129+ // Warn about NFS "silly rename"
130+ console . error ( 'Note: ".nfs*" might be files that were open and ' +
131+ 'unlinked but not closed.' ) ;
132+ console . error ( 'See http://nfs.sourceforge.net/#faq_d2 for details.' ) ;
133+ }
134+
135+ console . error ( ) ;
136+ throw e ;
123137 }
124138}
125139
You can’t perform that action at this time.
0 commit comments