fix(watcher.node): Handle fs.watch close without spurious restarts; add tests and improve test runner
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartwatch',
|
||||
version: '6.2.0',
|
||||
version: '6.2.1',
|
||||
description: 'A cross-runtime file watcher with glob pattern support for Node.js, Deno, and Bun.'
|
||||
}
|
||||
|
||||
@@ -339,8 +339,9 @@ export class NodeWatcher implements IWatcher {
|
||||
|
||||
// Handle 'close' event - fs.watch can close without error
|
||||
watcher.on('close', () => {
|
||||
console.warn(`[smartwatch] FSWatcher closed unexpectedly for ${watchPath}`);
|
||||
// Only log/restart if we didn't intentionally stop
|
||||
if (this._isWatching) {
|
||||
console.warn(`[smartwatch] FSWatcher closed unexpectedly for ${watchPath}`);
|
||||
this.restartWatcher(watchPath, new Error('Watcher closed unexpectedly'));
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user