-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
fs: improve errors from watch, watchFile and unwatchFile #19345
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Remove ERR_FS_WATCHER_ALREADY_STARTED and ERR_FS_WATCHER_NOT_STARTED because those two situations should result in noop instead of errors for consistency with the documented behavior of fs.watchFile. This partially reverts nodejs#19089 - Update comments about this behavior. Refs: nodejs#19089
- Check if the watcher is active in JS land before invoking the binding, act as a noop if the state of the watcher does not match the expectation. This avoids firing 'stop' when the watcher is already stopped. - Update comments, validate more arguments and the type of the handle. - Handle the errors from uv_fs_poll_start - Create an `IsActive` helper method on StatWatcher
nodejs-github-bot
added
c++
Issues and PRs that require attention from people who are familiar with C++.
lib / src
Issues and PRs related to general changes in the lib or src directory.
labels
Mar 14, 2018
joyeecheung
added
fs
Issues and PRs related to the fs subsystem / file system.
semver-major
PRs that contain breaking changes and should be released in the next major version.
labels
Mar 14, 2018
CI: https://ci.nodejs.org/job/node-test-pull-request/13675/ cc @nodejs/tsc this is semver-major because of the additional throw. Please review, thanks! |
joyeecheung
added
the
errors
Issues and PRs related to JavaScript errors originated in Node.js core.
label
Mar 14, 2018
jasnell
approved these changes
Mar 15, 2018
@nodejs/tsc this needs one more approval to land..thanks! |
targos
approved these changes
Mar 18, 2018
mcollina
approved these changes
Mar 18, 2018
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Landed in 897cec4...897f7b6, thanks! |
joyeecheung
added a commit
that referenced
this pull request
Mar 18, 2018
- Remove ERR_FS_WATCHER_ALREADY_STARTED and ERR_FS_WATCHER_NOT_STARTED because those two situations should result in noop instead of errors for consistency with the documented behavior of fs.watchFile. This partially reverts #19089 - Update comments about this behavior. Refs: #19089 PR-URL: #19345 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
joyeecheung
added a commit
that referenced
this pull request
Mar 18, 2018
- Check if the watcher is active in JS land before invoking the binding, act as a noop if the state of the watcher does not match the expectation. This avoids firing 'stop' when the watcher is already stopped. - Update comments, validate more arguments and the type of the handle. - Handle the errors from uv_fs_poll_start - Create an `IsActive` helper method on StatWatcher PR-URL: #19345 Refs: #19089 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
c++
Issues and PRs that require attention from people who are familiar with C++.
errors
Issues and PRs related to JavaScript errors originated in Node.js core.
fs
Issues and PRs related to the fs subsystem / file system.
lib / src
Issues and PRs related to general changes in the lib or src directory.
semver-major
PRs that contain breaking changes and should be released in the next major version.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fs: remove watcher state errors for fs.watch
ERR_FS_WATCHER_NOT_STARTED because those two situations should
result in noop instead of errors for consistency with the
documented behavior of fs.watchFile.
This partially reverts fs: improve errors thrown from fs.watch() #19089
Refs: #19089
fs: improve errors in watchFile and unwatchFile
invoking the binding, act as a noop if the state of
the watcher does not match the expectation. This
avoids firing 'stop' when the watcher is already
stopped.
the type of the handle.
IsActive
helper method on StatWatcherChecklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes