Open kireerik opened 6 years ago
I can rename folders while gaze is watching.
Can you do it under Windows?
@kireerik We could probably save a lot of time if you post repro steps and more information about your environment and issue you are running into.
This is the minimal code where the issue is reproducible:
const {Gaze} = require('gaze')
new Gaze('watchedDirectory' + '/**')
If I try to edit a folder name within a watched folder for example using Windows' file manager then I am getting an error prompt like this:
"The action can't be completed because the folder or a file in it is open in another program"
So it can not be renamed while Gaze is watching.
Windows version? Node.js version? Are you watching files from a vagrant things or shared folder or dropbox, etc
Also gaze watches file patterns, so instead of doing new Gaze('watchedDirectory' + '/**')
, the 'watchedDirectory'
probably isnt a file pattern. So do new Gaze('**', { cwd: 'watcheDir' })
instead.
Windows 10 Pro 1083
Node.js 10.4.0
No it is a simple folder.
I see. new Gaze('**', { cwd: 'watcheDir' })
doesn't makes any difference.
Nothing else running that could be holding those files?
FWIW, we have tests that rename files gaze is watching that passes on Windows and this is the first Ive heard of this issue.
No, nothing else. As soon as I stop Gaze I can rename a folder.
As I can see the linked test is for renaming a file and not a folder.
I think Gaze is probably watching all files through watching the sub folders recursively or something like that. I can't modify the watched folder's name either, which makes sense and it seems to me that the sub folders are working just the same way.
Renaming an empty folder works mostly, but for the 2. renaming I get the following error:
events.js:167
throw er; // Unhandled 'error' event
^
Error: ENOENT: no such file or directory, watch 'site\folder\'
at FSWatcher.start (fs.js:1409:26)
at Object.fs.watch (fs.js:1446:11)
at Gaze._watchDir (node_modules\gaze\lib\gaze.js:314:30)
at node_modules\gaze\lib\gaze.js:387:10
at iterate (node_modules\gaze\lib\helper.js:69:5)
at node_modules\gaze\lib\helper.js:78:11
at node_modules\gaze\lib\gaze.js:452:5
at iterate (node_modules\gaze\lib\helper.js:69:5)
at node_modules\gaze\lib\helper.js:78:11
at node_modules\gaze\lib\gaze.js:452:5
Emitted 'error' event at:
at Gaze.emit (node_modules\gaze\lib\gaze.js:102:32)
at Gaze._handleError (node_modules\gaze\lib\gaze.js:468:15)
at Gaze._watchDir (node_modules\gaze\lib\gaze.js:331:17)
at node_modules\gaze\lib\gaze.js:387:10
[... lines matching original stack trace ...]
at node_modules\gaze\lib\gaze.js:452:5
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
folderCurrent
was renamed to folder
which was renamed to folderNext
. Watched directory is site
.
A non empty folder gives the above error as well, but right away with the 1. renaming.
Adding an empty folder within the folder
makes no difference, but once I add a file to the newly added folder the initially described issue occurs with the error prompt and the folder name can not be modified.
I think we should keep this issue opened, since it is well defined by now and it is also consistently reproducible.
Sure I'll reopen and assign to you. I cannot repro.
All right, thank you!
May I ask you on which system can you not reproduce this?
(This might helps you to reproduce, if it is an issue on your system as well: https://github.com/shama/gaze/issues/249#issue-331191188)
Minimal directory structure:
<-
can not rename while Gaze watching<-
can rename with error