You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -345,6 +345,25 @@ The anti-pattern is using timeouts to "fix" async cleanup issues.
345
345
346
346
**Current Status**: The BackupJob implementation correctly uses `Napi::AsyncProgressWorker`, which is the proper Node.js async pattern. This ensures threads are properly managed and cleaned up.
347
347
348
+
## Windows-Compatible Directory Cleanup
349
+
350
+
**IMPORTANT**: Never use `fs.rmSync()` or `fs.rm()` without proper Windows retry logic for directory cleanup in tests.
351
+
352
+
**Problem**: On Windows, SQLite database files can remain locked longer than on Unix systems, causing `EBUSY` errors during cleanup.
353
+
354
+
**Proper Solution**: Use `fsp.rm()` (async) with retry options:
355
+
356
+
```typescript
357
+
awaitfsp.rm(tempDir, {
358
+
recursive: true,
359
+
force: true,
360
+
maxRetries: process.platform==="win32"?3:1,
361
+
retryDelay: process.platform==="win32"?100:0,
362
+
});
363
+
```
364
+
365
+
**Best Practice**: Use the existing test utilities (`useTempDir`, `useTempDirSuite`) which already handle Windows-compatible cleanup. Don't manually clean up temp directories - let the test framework handle it.
0 commit comments