-
Notifications
You must be signed in to change notification settings - Fork 35
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 PollingFileWatcher.ready for files that don't exist #157
Conversation
There were a few issues here: - FileWatcher.ready never fired for files that don't exist because of logic inside FileWatcher existing early if the modification time was `null` - The test I recently added trying to catch this was incorrectly passing because the mock timestamp code was set so that files that had not been created would return a 0-mtime whereas in the real implementation they return `null` So this change a) updates the mock to return `null` for uncreated files (to match the real implementation) which breaks a bunch of tests b) fixes those tests by updating FileWatcher._poll() to handle `null` mtime separately from being the first poll.
There's a failure here:
This happens because now the timestamp code is "fixed", this rename looks like a new folder because |
Pushed some additional changes:
|
@jakemac53 this ended up touching a little more than originally planned, but I think it all makes sense and should result in the tests running with behaviour that much better matches the real fs (and ofc, doesn't mask issues like dart-lang/sdk#54116) :-) Please review carefully - I'd like to roll this into the SDK once merged :-) |
This would result in Remove events for files that don't still exist on the second poll
I do think we should wait to land/publish this until after the thanksgiving break if that is alright |
@jakemac53 yeah, that's fine by me. It isn't urgent - I'd just like to ensure I do some final testing once it gets into the analyzer and not forget about it after it lands :) |
@jakemac53 how about now? :) still not urgent, just still on my list to not forget about 😄 |
I will circle back soon, lots of things to catch up on 🤣 |
@DanTup it sounds like you are going to try merging this into the SDK prior to publishing? |
@jakemac53 I've opened https://dart-review.googlesource.com/c/sdk/+/339401 to roll this into the SDK, and have confirmed locally the failing test now passes. I don't need the Pub package, so I'll leave it to you to decide when to publish. Thanks! :-) |
This updates the watcher package to include a fix for the `ready` Future not completing for non-existent folders on Windows: dart-lang/watcher#157 This fixes a bug where the analyzer would wait indefinitely during initialisation if the workspace contained a folder that did not existing on disk (such as if you have a .code-workspace containing folders and one was subsequently deleted). Fixes #54116 Change-Id: If283403681080477e497fe7e17f2faa217a5a643 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339401 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
…tcher#157) There were a few issues here: - FileWatcher.ready never fired for files that don't exist because of logic inside FileWatcher existing early if the modification time was `null` - The test I recently added trying to catch this was incorrectly passing because the mock timestamp code was set so that files that had not been created would return a 0-mtime whereas in the real implementation they return `null` So this change a) updates the mock to return `null` for uncreated files (to match the real implementation) which breaks a bunch of tests b) fixes those tests by updating FileWatcher._poll() to handle `null` mtime separately from being the first poll.
There were a few issues here:
null
null
So this change
a) updates the mock to return
null
for uncreated files (to match the real implementation) which breaks a bunch of testsb) fixes those tests by updating FileWatcher._poll() to handle
null
mtime separately from being the first poll.Thanks for your contribution! Please replace this text with a description of what this PR is changing or adding and why, list any relevant issues, and review the contribution guidelines below.
I’ve reviewed the contributor guide and applied the relevant portions to this PR.