Uh oh!
There was an error while loading. Please reload this page.
fs: add 'close' event to FSWatcher - #19900
Conversation
mscdex
commented
Apr 9, 2018
A test would be good, yes. |
cjihrig
commented
Apr 9, 2018
Docs are needed as well. |
mcollina
commented
Apr 10, 2018
Why do you need a |
@mcollina To keep the functionwatch(root){returnfs.watch(root,(evt,file)=>{// ...}).on('close',()=>{// ...})}Currently, I'm monkey-patching the functionwatch(root){letwatcher=fs.watch(root,(evt,file)=>{// ...})let{close}=watcherwatcher.close=function(){close.call(watcher)// ...}returnwatcher} |
mcollina
commented
Apr 10, 2018
@aleclarson definitely better. Can you add a unit test? |
aleclarson
commented
Apr 10, 2018
Added a test and docs. Note the |
mcollina
commented
Apr 10, 2018
@aleclarson the |
There was a problem hiding this comment.
You can drop the closeCount, and just write watcher.on('close', common.mustCall());
There was a problem hiding this comment.
Does that protect against multiple calls?
aleclarson
commented
Apr 10, 2018
Good to go 👍 |
There was a problem hiding this comment.
Can you wrap this in a process.nextTick()? Zalgo and all that.
BridgeAR
commented
Apr 12, 2018
Ping @aleclarson |
aleclarson
commented
Apr 12, 2018
Now wrapped with |
jasnell
commented
Apr 14, 2018
lpinca
commented
Apr 16, 2018
Landed in 5cc948b. |
PR-URL: #19900 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: #19900 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: nodejs#19900 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Should
process.nextTickwrap this? Are tests necessary here?