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

fix: watch exclude flag with watch flag for the directory containing the excluded file #26309

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

HasanAlrimawi
Copy link
Contributor

@HasanAlrimawi HasanAlrimawi commented Oct 16, 2024

closes #26217

Changes

  • Check and suppress restarting if the changed file is marked to be excluded from watching.

Problem Root

In cli/util/file_watcher.rs this line let _ = watcher.watch(path, RecursiveMode::Recursive);.
This causes issue if the path is directory since this will recursively watch all files and subdirectories, thus the excluded files will be watched if they are within that directory.

P.S. I initially tried to solve the issue by: (Failed approaches)
1) Using watcher.watch() for every file and folder within the directory and avoiding watching the excluded file and the directory itself, but that will prevent watching any new files made during runtime within the directory.
2) Using watcher.unwatch() for the excluded file but that didn't work, since the directory is watched. I noticed the same issue tracked in this issue.

@bartlomieju
Copy link
Member

@HasanAlrimawi thanks for the PR. Do you think you could add a test for this change?

@HasanAlrimawi
Copy link
Contributor Author

@bartlomieju
The test I added never folds under the ci / test debug windows-x86_64 check although it succeeds in all other checks and runs successfully on my local machine running on windows.

Could you help with that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--watch-exclude doesn't work
2 participants