chokidar: Node doesn't exit after closing watch
After setting up, then closing, a watcher, the Node process doesn’t exit. Windows.
const chokidar = require('chokidar')
const options = {}
const directoryPath = srcPath
// configuration taken from webpack
const watcher = chokidar.watch(directoryPath, {
ignoreInitial: true,
persistent: true,
followSymlinks: false,
depth: 0,
atomic: false,
alwaysStat: true,
ignorePermissionErrors: true,
usePolling: options.poll ? true : undefined,
interval: typeof options.poll === "number" ? options.poll : undefined
});
watcher.close()
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 4
- Comments: 32
Commits related to this issue
- https://github.com/paulmillr/chokidar/issues/434 — committed to azaslavsky/karma-remap-istanbul by azaslavsky 8 years ago
- Updated chokidar dependency This fixes a race condition which could cause freezes on MacOS See: https://github.com/paulmillr/chokidar/issues/434 — committed to Azure/BatchExplorer by dpwatrous 3 years ago
I confirm the problem. No nested directories are required. A simple code to reproduce:
Interesting point to note - just run the code above and wait doing nothing - it will exit the node process in 10 seconds without any problems. It will NOT exit in case there will be some file modifications in the current dir before
watcher.close. So even once change/unlink/add are triggered and this hangs the process.