Compare commits

..

2 Commits

Author SHA1 Message Date
ca9a66e03e v6.3.1
Some checks failed
Default (tags) / security (push) Failing after 0s
Default (tags) / test (push) Failing after 0s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-03-23 11:28:50 +00:00
48081302c8 fix(watcher): unref lingering FSWatcher handles after stopping the node watcher 2026-03-23 11:28:50 +00:00
4 changed files with 16 additions and 2 deletions

View File

@@ -1,5 +1,11 @@
# Changelog
## 2026-03-23 - 6.3.1 - fix(watcher)
unref lingering FSWatcher handles after stopping the node watcher
- Ensures chokidar file watcher handles do not keep the process running after watcher shutdown
- Works around chokidar v5 behavior where close() can resolve before all fs.watch() handles are fully released
## 2025-12-11 - 6.3.0 - feat(watchers)
Integrate chokidar-based Node watcher, expose awaitWriteFinish options, and update docs/tests

View File

@@ -1,6 +1,6 @@
{
"name": "@push.rocks/smartwatch",
"version": "6.3.0",
"version": "6.3.1",
"private": false,
"description": "A cross-runtime file watcher with glob pattern support for Node.js, Deno, and Bun.",
"main": "dist_ts/index.js",

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartwatch',
version: '6.3.0',
version: '6.3.1',
description: 'A cross-runtime file watcher with glob pattern support for Node.js, Deno, and Bun.'
}

View File

@@ -90,6 +90,14 @@ export class NodeWatcher implements IWatcher {
this.watcher = null;
}
// Unref any lingering FSWatcher handles from chokidar so they don't prevent process exit.
// Chokidar v5's close() resolves before all fs.watch() handles are fully released.
for (const handle of (process as any)._getActiveHandles()) {
if (handle?.constructor?.name === 'FSWatcher' && typeof handle.unref === 'function') {
handle.unref();
}
}
this._isWatching = false;
console.log('[smartwatch] Watcher stopped');
}