Skip to content

Commit 27e156a

Browse files
danieliserclaude
andcommitted
fix(quickjs): use unref() on cleanup interval to prevent hang
Added `unref()` call to QuickJS cleanup interval timer to allow Node.js process to exit even with active interval. **Issue**: QuickJS sandbox cleanup interval runs every 15 seconds, preventing process exit during coverage runs and test completion. **Solution**: Call `unref()` on setInterval to mark it as not preventing process exit. Process can now cleanly terminate when all active work completes. **Impact**: Coverage runs now complete successfully in ~60s instead of hanging indefinitely. Test results with fix: - All unit tests pass - Coverage collection completes - Process exits cleanly after tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fb0f151 commit 27e156a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/sandbox/quickjs-runtime.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,10 @@ export class QuickJSSandbox {
374374
this.cleanupInterval = setInterval(() => {
375375
this.cleanupIdleWorkers();
376376
}, this.idleTimeout / 2);
377+
// Prevent interval from keeping process alive during test cleanup
378+
if (this.cleanupInterval.unref) {
379+
this.cleanupInterval.unref();
380+
}
377381
}
378382

379383
private cleanupIdleWorkers(): void {

0 commit comments

Comments
 (0)