Comments (3)
Do you mean it's no longer recursively watching everything in a directory? It was working at some point - we couldn't always get the exact filename that had changed, but could at least detect change events.
I would like to unify the system calls. I'm hesitant though because as noted in nodejs/node-v0.x-archive#2049, it's not totally clear which option is preferred - the core guys stated at one point that watchFile
will be going away, and the docs instruct you to use watch
when available. But watch
still has some bugs and doesn't always pass a filename, which would be a problem for a couple of our features. And just to compound matters, it's unclear from the docs if watchFile
makes use of inotify
etc when available, or if it is a purely polling solution (at one point it was using inotify, but maybe that's only happening in watch
now).
So my point is that neither of the options looks totally great to me right now. Thoughts?
from node-supervisor.
As you know node-supervisor
watch the root directory only via fs.watch
on Windows. And according to the implement of the fs.watch
the fourth option is FALSE
that means ReadDirectoryChangesW
doesn't watch files recursively at all.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365465(v=vs.85).aspx
Not just leaking exact filename, but leaking the event too.
I can understand why the implementation of fs.watch
use the option, because making too big size of buffer for watch huge number of files leads to get the BSOD. And also understand your concern about polling many files with fs.watchFile
.
So here is my thought: seek directories recursively like non-windows implementation and watch directory only not each files.
pseudo code:
var findAllWatchFiles = function(dir, callback) {
dir = path.resolve(dir);
if (ignoredPaths[dir])
return;
fs.stat(dir, function(err, stats){
if (err) {
util.error('Error retrieving stats for file: ' + dir);
} else {
if (stats.isDirectory()) {
if (isWindows) callback(dir);
fs.readdir(dir, function(err, fileNames) {
if(err) {
util.error('Error reading path: ' + dir);
}
else {
fileNames.forEach(function (fileName) {
findAllWatchFiles(dir + '/' + fileName, callback);
});
}
});
} else {
if (!isWindows && dir.match(fileExtensionPattern)) {
callback(dir);
}
}
}
});
};
from node-supervisor.
Closed by #70.
from node-supervisor.
Related Issues (20)
- node native Inspector not work with custom port using supervisor HOT 5
- not possible to have colored output (using the unbuffer trick, doesnt work)
- Does not work with node 7 HOT 3
- package.json license is "MIT", but the actual LICENSE file is BSD-2.
- How to add node --max-old-space-size flag? HOT 3
- Conflict with phantomjs while converting to pdf HOT 1
- Prevent developers from unintentionally killing daemon / worker processes on local machine
- why my node-supervisor doesn't work
- 100% CPU load when I use 'supervisor app.js' but when I use' node app.js ' just only 5% CPU load HOT 4
- Supervisor stop accepting "rs" to restart
- bash: supervisor: command not found HOT 2
- problem with --experimental-modules HOT 1
- How do I listen for all types of files?
- Recurse over directories
- Is there a way to use the preload args of node? HOT 3
- is there a way to exit on error instead of hanging?
- can this run Python as well?
- Infinite restarts of "Starting child process" HOT 2
- Arguments Incorrectly Parsed HOT 3
- Can this be run in background?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-supervisor.