Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EACCES when renaming folder that is being watched from nodejs #3395

Closed
alexandrudima opened this issue Jul 20, 2018 · 1 comment

Comments

@alexandrudima
Copy link
Member

commented Jul 20, 2018

Microsoft Windows [Version 10.0.17134.112]

I am trying to use chokidar, a popular nodejs file system watcher library.

Whenever I use chokidar to listen for file system changes, I can no longer rename folders that lie within the folder being watched.

  • npm install chokidar
  • mkdir test
  • echo hello > test/test.txt
  • create repro.js:
var fs = require('fs');
var chokidar = require('chokidar');

// Watch current directory and ignore the node_modules folder
chokidar.watch('.', {ignored: /node_modules/}).on('all', (event, path) => {
  console.log(event, path);
});

// After sufficient time, attempt to rename the test folder
// Note: this is also reproducible using `mv` on the command line
setTimeout(function() {
    fs.rename('test', 'test2', function(err) {
        if (err) {
            console.log(err);
        } else {
            console.log('rename ok');
        }
    });
}, 1000);

WSL (Ubuntu 18.04):
image

Ubuntu 18.04:
image

I don't think it is terribly important (other colleagues are able to reproduce with other node versions), but I am using nodejs v8.11.3

@therealkenc

This comment has been minimized.

Copy link
Collaborator

commented Jul 20, 2018

I don't think it is terribly important (other colleagues are able to reproduce with other node versions)

Nah it's a manifestation of about the most pervasive bug around here (if you don't count 0xhexdigits fail at startup). Call this dupe #1956 but you can pick any dating back to #14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.