Skip to content

can't watch entire C drive using node 0.11 on windows #229

@reverofevil

Description

@reverofevil

When running the following example on Node 0.11.15

var chokidar = require('chokidar');

var watcher = chokidar.watch('C:\\', {
    persistent: true, ignorePermissionErrors: true
});

var log = console.log.bind(console);

watcher
    .on('add', function(path) { log('File', path, 'has been added'); })
    .on('addDir', function(path) { log('Directory', path, 'has been added'); })
    .on('change', function(path) { log('File', path, 'has been changed'); })
    .on('unlink', function(path) { log('File', path, 'has been removed'); })
    .on('unlinkDir', function(path) { log('Directory', path, 'has been removed'); })
    .on('error', function(error) { log('Error happened', error); })
    .on('ready', function() { log('Initial scan complete. Ready for changes.'); })
    .on('raw', function(event, path, details) { log('Raw event info:', event, path, details); })

watcher.on('change', function(path, stats) {
    if (stats) console.log('File', path, 'changed size to', stats.size);
});

we get something like this in the output

Directory C:\ has been added
Directory C:\ has been removed
Directory C:\$Recycle.Bin has been added
Directory C:\Program Files has been added
Directory C:\ProgramData has been added
Directory C:\Users has been added
Directory C:\Windows has been added
Directory C:\Recovery has been added
Error happened { [Error: watch EINVAL] code: 'EINVAL', errno: 'EINVAL', syscall: 'watch' }
File C:\IO.SYS has been added
Error happened { [Error: watch EINVAL] code: 'EINVAL', errno: 'EINVAL', syscall: 'watch' }
File C:\MSDOS.SYS has been added
Directory C:\Documents and Settings has been added

and then the program exits.

It seems that this is an issue with Node itself, but I'm not proficient to report it. Anyway, it seems that chokidar is a library that was meant to work a bit more stable that default fs.watch, so you may be interested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions