Skip to content

fs: make FSStatWatcher.start private

Similar to https://github.com/nodejs/node/pull/29905

An instance of FSStatWatcher is returned when a user calls fs.watchFile, which will call the start method. A user can't create an instance of a FSStatWatcher directly. If the start method is called by a user it is a noop since the watcher has already started.

ATM, a user could call start on a closed watcher and i believe it would restart it, however, they would need to re-pass the filename and other function parameters. I haven't actually tested that out, though. This is what i see from the code. It would be nice if it acted in a similar fashion to the FSWatch class, and a noop would happen if start was called on a closed watcher, but if this function becomes private, then that wouldn't matter

This method is also undocumented, in fact, the whole "Class" FSStatWatcher seems to be undocumented, although that can be a different issue/PR

This PR makes this method private, and would be a semver-major change, similar to the link issue above

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Merge request reports

Loading