Fix logfile tailing under Node 10.16.0 #84
Merged
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.watch
does not consistently emit'change'
events on Node 10.16.0,possibly due to nodejs/node#29460.
fs.watchFile
still works, but is less efficient, per the docs, so fall back to that only if necessary and also suggest that users run custody under an older version of Node.
I explored several Node file-watching libraries (e.g. chokidar, sane) to try to
find a more performant solution for Node 10.16.0 and it seems that they pretty
much all fall back to
fs.watch
/fs.watchFile
, unfortunately. sane offersthe option to use watchman, but that requires installing a daemon so is a
non-starter.
Fixes #82.
#83 tracks reverting this when the underlying Node issue has been fixed.
Tested that log files update both when running custody under v8.9.3 and
v10.16.0, and that
node-tail
only usesfs.watchFile
in the latter.