Uh oh!
There was an error while loading. Please reload this page.
fs: migrate fs_event_wrap to internal/errors - #17851
Conversation
maclover7
commented
Jan 4, 2018
ping @TimothyGu |
targos
commented
Jan 15, 2018
@maclover7#17682 landed. Can you please rebase? |
maclover7
commented
Jan 20, 2018
updated @targos |
maclover7
commented
Jan 20, 2018
There was a problem hiding this comment.
this is not the same, why this change?
It seems we are not exposing start at all, see https://nodejs.org/api/fs.html#fs_class_fs_fswatcher.
I think we should add it to the docs.
There was a problem hiding this comment.
Looks like this should be watcher.start(testCase[testCase.field])?
There was a problem hiding this comment.
There was a problem hiding this comment.
Umm, looking more closely I think .start() is accepted the second time it is called (i.e. the wrap is already initialized to watch on a file), so in JS land we should check if the wrap is initialized before calling validatePath(). The easiest way to do it is to store a field in the FSWatcher.prototype.start() in JS land, echoing what's being done in the C++ land (it also needs to be updated in .close())
There was a problem hiding this comment.
Or, if we don't want to return silently when someone tries to call .start() again on the initialized watcher:
if(!isInitialized){validatePath(filename);}else{throwerrors.Error('ERR_FS_EVENT_STARTED');// A new Error indicating this has been started.}If we don't even want to document .start(), we can just assert(isInitialized) instead of creating a public error for it.
mhdawson
left a comment
There was a problem hiding this comment.
LGTM once comment about watcher.start() is addressed.
updated @joyeecheung PTAL |
| function FSWatcher() { | ||
| EventEmitter.call(this); | ||
| this._initialized = false; |
There was a problem hiding this comment.
Can you add a comment here mentioning that this should be kept in sync with the initialized field of the C++ wrap? (Arguably better if this is an accessor property on the prototype of FSWatcher, that way there is no need to set this field in start and close, although that brings a few more calls into C++ so I am fine with this as well)
joyeecheung
commented
Feb 5, 2018
BridgeAR
commented
Feb 10, 2018
@maclover7 would you be so kind and rebase and also address the comment? |
BridgeAR
commented
Feb 16, 2018
Ping @maclover7 |
BridgeAR
commented
Mar 2, 2018
Closing due to no further progress. @maclover7 please feel free to reopen in case you would like to continue working on this. |
Migrates
fs_event_wrap.ccto internal/errors style.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
fs