-
-
Notifications
You must be signed in to change notification settings - Fork 586
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
Windows: Cannot delete watched folder with not-empty subfolder #422
Comments
Have you tried switching the |
Yes, it works with polling, but it also leads to 20% CPU usage vs 0% (7000 files). |
I found the problem: My experiments show that on Windows you cannot delete a folder if it has a subfolder that is being watched inside. A possible solution would be to use I've spent the last week developing my own watcher which uses this approach. Two things I've learned (if you're interested):
I'm closing this. Enabling recursive mode is a major change for chokidar. Feel free to reopen if you decide to tackle it :) |
I do intend to work toward utilizing I also hope to eventually drop the fsevents optional dependency while leaving the handling code in place so users who prefer it have the option to add it themselves and use that watching mode. But I'd only consider that a viable possibility if the use of Adding handler code for watchman and pathwatcher with the same approach (user needs to directly install the underlying module to utilize it) would be cool too - giving power users more options and control over their dependencies. Anyway, all that is tangential to the original issue, which I'll leave closed because it's a Windows behavior relating to watched folders being considered in use that chokidar cannot do anything about. Users encountering this problem should close the watcher prior to deleting in this way. |
Nice to hear! In my implementation I built a hierarchy of Anyway, what I'd like to ask: My watcher is barely a week old, so there's a change that I didn't encounter it yet - But why exactly doesn't |
The problem I've observed with it that I could not resolve with logic in chokidar was sporadic duplicate/phantom events - And since chokidar still aims to support versions prior to Otherwise, it can be seen from the test suite passing that chokidar in fs.watch mode on Mac does do alright. But switching to it as the default mode has to be considered very carefully - if it causes issues for more people than fsevents does now, it would be a step backward. |
Alright then. Great to hear :) BTW here are some benchmark results for the inital scan (10 samples, 7800 entries):
Note: Take this with a grain of salt. Although my watcher explores the same hierarchy, it has a lot less features, e.g. currently not even ignore patterns. However, I really wonder why the difference is so huge. Do you parallelize everything? |
What do you mean by "initial scan"? When I use that term it has little to do with the watching strategy - it's about walking the file tree to get a memory model of what's on disk. There's filtering type of stuff happening there too. At the moment that's done with readdirp, but that's another area that's going to be focused on for more optimization (see #412, for instance). You haven't provided a link to or shown your code, so I don't really know what you're doing (or not doing) differently to have that perf impact. But if the stripped down approach is working better for you, great. |
I mean the same thing. In the case of chokidar I measure the time between
Jep and that's lousy. But it's part of a bigger project which I won't open-source until it's ready. If you really like to have a look, then this can be arranged though. |
I noticed that I cannot delete a watched folder that has a not-empty subfolder on Windows. Here're two examples:
a/b/c.txt
. Chokidar picks up the change just fine. Then, I try to deletea/
. This curiously doesn't work. Workaround: First deletea/b/
, then deletea/
.a/b/c/
. Directly deletinga/
fails. Deletinga/b/
first, thena/
works.Is this a known issue? Can it be fixed?
The text was updated successfully, but these errors were encountered: