Skip to content

Commit

Permalink
less strict rmdir error check (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
mafintosh committed May 30, 2023
1 parent 8f74a2a commit 6ca7eb4
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,7 @@ module.exports = class RandomAccessFile extends RandomAccessStorage {

function onrmdir (err) {
dir = path.join(dir, '..')

const isAlreadyUnlinked = err && err.code === 'ENOENT'
const isNotEmpty = err && err.code === 'ENOTEMPTY'
if (isAlreadyUnlinked || isNotEmpty || dir === root) return req.callback(null)

if (err) return req.callback(err)
if (err || dir === root) return req.callback(null)
fs.rmdir(dir, onrmdir)
}
}
Expand Down

0 comments on commit 6ca7eb4

Please sign in to comment.