You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
vfs: RealFSProvider.watchFile ignores the listener and unwatchFile leaks it #66223
import{mkdtempSync,watchFile,writeFileSync,unwatchFile}from"fs";import{create,RealFSProvider}from"node:vfs";constd=mkdtempSync("/tmp/v-");constf=create(newRealFSProvider(d)).mount()+"/f";constcb=()=>console.log("fired");watchFile(f,{interval:50},cb);setTimeout(()=>writeFileSync(f,"x"),50);setTimeout(()=>{unwatchFile(f,cb);console.log("done, should exit");},200);
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
firedfireddone, should exit
fired prints within ~50–100ms of the write (the { interval: 50 } poll detects the stat change), then unwatchFile(f, cb) at 200ms removes the callback and the process exits cleanly with code 0.
What do you see instead?
done, should exit<process hangs>
fired never prints - even though the change happens at 50ms and the watcher polls every 50ms for 150ms before unwatch. cb was never registered at all. The hang after done, should exit is the leaked stub keeping the loop alive.
Activity