emptyDir callback firing twice on EPERM error
See original GitHub issueThe callback is firing twice on my computer when the folder supplied cannot be removed because it is currently accessed by another program.
fs.emptyDir(`${directory}/public/cache`, function(error){
console.log('Callback')
});
I have no problem if I use fs.emptyDirSync. I was running version 2.1.1 of fs-extra.
Issue Analytics
- State:
- Created 7 years ago
- Comments:13
Top Results From Across the Web
Node.js fires callback twice, why? - javascript - Stack Overflow
Incorrect error handling made the script faulty. In the moveFile function this part was wrong: fs.rename(tempFileName, newFilePath, ...
Read more >fs-extra/CHANGELOG.md - UNPKG
`pathExists` has a normal error-first callback signature. ... Weird windows bug that resulted in `ensureDir()`'s callback being called twice in some cases.
Read more >fs-extra | Yarn - Package Manager
It also uses graceful-fs to prevent EMFILE errors. It should be a drop in replacement for fs . npm Package License build status...
Read more >[PATCH v3 00/19] dlb2: introduce DLB 2.0 device driver - kernel
+ +Port +==== + +A core's interface to the DLB 2.0 is called a "port," ... so the +driver uses its reset_prepare callback...
Read more >Viewing online file analysis results for 'app.asar'
"EPERM": " ... getLicenseInfo(callback); expect(callback.called).to.be.true; ... error.code) { switch (error.code) { case 'ENOTDIR': case 'EPERM': case ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fixed in v2.1.2
OK, that needs to be fixed in our codebase. Also, that patch needs to be forwarded to
rimraf
, since this bug also probably exists there too. (fs-extra’sremove
is a customized version ofrimraf
.)I’ll try to get this done.