| 57 | } |
| 58 | |
| 59 | function onexit(useSpawn) { |
| 60 | // Change directory to avoid possible EBUSY |
| 61 | if (isMainThread) |
| 62 | process.chdir(testRoot); |
| 63 | |
| 64 | try { |
| 65 | rmSync(tmpPath, useSpawn); |
| 66 | } catch (e) { |
| 67 | console.error('Can\'t clean tmpdir:', tmpPath); |
| 68 | |
| 69 | const files = fs.readdirSync(tmpPath); |
| 70 | console.error('Files blocking:', files); |
| 71 | |
| 72 | if (files.some((f) => f.startsWith('.nfs'))) { |
| 73 | // Warn about NFS "silly rename" |
| 74 | console.error('Note: ".nfs*" might be files that were open and ' + |
| 75 | 'unlinked but not closed.'); |
| 76 | console.error('See http://nfs.sourceforge.net/#faq_d2 for details.'); |
| 77 | } |
| 78 | |
| 79 | console.error(); |
| 80 | throw e; |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | function resolve(...paths) { |
| 85 | return path.resolve(tmpPath, ...paths); |