nav tabs on admin dashboard
This commit is contained in:
38
node_modules/fs-extra/lib/remove/rimraf.js
generated
vendored
38
node_modules/fs-extra/lib/remove/rimraf.js
generated
vendored
@@ -33,19 +33,19 @@ function rimraf (p, options, cb) {
|
||||
}
|
||||
|
||||
assert(p, 'rimraf: missing path')
|
||||
assert.equal(typeof p, 'string', 'rimraf: path should be a string')
|
||||
assert.equal(typeof cb, 'function', 'rimraf: callback function required')
|
||||
assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string')
|
||||
assert.strictEqual(typeof cb, 'function', 'rimraf: callback function required')
|
||||
assert(options, 'rimraf: invalid options argument provided')
|
||||
assert.equal(typeof options, 'object', 'rimraf: options should be object')
|
||||
assert.strictEqual(typeof options, 'object', 'rimraf: options should be object')
|
||||
|
||||
defaults(options)
|
||||
|
||||
rimraf_(p, options, function CB (er) {
|
||||
if (er) {
|
||||
if (isWindows && (er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') &&
|
||||
if ((er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') &&
|
||||
busyTries < options.maxBusyTries) {
|
||||
busyTries++
|
||||
let time = busyTries * 100
|
||||
const time = busyTries * 100
|
||||
// try again, with the same exact callback as this one.
|
||||
return setTimeout(() => rimraf_(p, options, CB), time)
|
||||
}
|
||||
@@ -117,7 +117,7 @@ function fixWinEPERM (p, options, er, cb) {
|
||||
assert(er instanceof Error)
|
||||
}
|
||||
|
||||
options.chmod(p, 666, er2 => {
|
||||
options.chmod(p, 0o666, er2 => {
|
||||
if (er2) {
|
||||
cb(er2.code === 'ENOENT' ? null : er)
|
||||
} else {
|
||||
@@ -144,7 +144,7 @@ function fixWinEPERMSync (p, options, er) {
|
||||
}
|
||||
|
||||
try {
|
||||
options.chmodSync(p, 666)
|
||||
options.chmodSync(p, 0o666)
|
||||
} catch (er2) {
|
||||
if (er2.code === 'ENOENT') {
|
||||
return
|
||||
@@ -229,9 +229,9 @@ function rimrafSync (p, options) {
|
||||
defaults(options)
|
||||
|
||||
assert(p, 'rimraf: missing path')
|
||||
assert.equal(typeof p, 'string', 'rimraf: path should be a string')
|
||||
assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string')
|
||||
assert(options, 'rimraf: missing options')
|
||||
assert.equal(typeof options, 'object', 'rimraf: options should be object')
|
||||
assert.strictEqual(typeof options, 'object', 'rimraf: options should be object')
|
||||
|
||||
try {
|
||||
st = options.lstatSync(p)
|
||||
@@ -289,7 +289,25 @@ function rmkidsSync (p, options) {
|
||||
assert(p)
|
||||
assert(options)
|
||||
options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options))
|
||||
options.rmdirSync(p, options)
|
||||
|
||||
if (isWindows) {
|
||||
// We only end up here once we got ENOTEMPTY at least once, and
|
||||
// at this point, we are guaranteed to have removed all the kids.
|
||||
// So, we know that it won't be ENOENT or ENOTDIR or anything else.
|
||||
// try really hard to delete stuff on windows, because it has a
|
||||
// PROFOUNDLY annoying habit of not closing handles promptly when
|
||||
// files are deleted, resulting in spurious ENOTEMPTY errors.
|
||||
const startTime = Date.now()
|
||||
do {
|
||||
try {
|
||||
const ret = options.rmdirSync(p, options)
|
||||
return ret
|
||||
} catch (er) { }
|
||||
} while (Date.now() - startTime < 500) // give up after 500ms
|
||||
} else {
|
||||
const ret = options.rmdirSync(p, options)
|
||||
return ret
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = rimraf
|
||||
|
||||
Reference in New Issue
Block a user