question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

emptyDir callback firing twice on EPERM error

See original GitHub issue

The 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:closed
  • Created 7 years ago
  • Comments:13

github_iconTop GitHub Comments

2reactions
RyanZimcommented, Mar 16, 2017

Fixed in v2.1.2

2reactions
RyanZimcommented, Mar 16, 2017

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’s remove is a customized version of rimraf.)

I’ll try to get this done.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found