Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Antoine du Hamel <[email protected]>
  • Loading branch information
RaisinTen and aduh95 authored Jun 3, 2021
commit ecac8c638190c8c1ca77010727c2c5a2d9ae3e95
44 changes: 8 additions & 36 deletions test/parallel/test-fs-rm.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,15 +315,8 @@ function removeAsync(dir) {
err = _err;
}

try {
fs.chmodSync(dirname, 0o777);
} catch {
}

try {
fs.chmodSync(filePath, 0o777);
} catch {
}
try { fs.chmodSync(dirname, 0o777); } catch {}
try { fs.chmodSync(filePath, 0o777); } catch {}

if (!isValidState(fs.existsSync(filePath), err)) {
throw err;
Expand All @@ -341,15 +334,8 @@ function removeAsync(dir) {
fs.chmodSync(dirname, 0o444);

fs.rm(filePath, { force: true }, common.mustCall((err) => {
try {
fs.chmodSync(dirname, 0o777);
} catch {
}

try {
fs.chmodSync(filePath, 0o777);
} catch {
}
try { fs.chmodSync(dirname, 0o777); } catch {}
try { fs.chmodSync(filePath, 0o777); } catch {}

if (!isValidState(fs.existsSync(filePath), err)) {
throw err;
Expand Down Expand Up @@ -391,15 +377,8 @@ function removeAsync(dir) {
err = _err;
}

try {
fs.chmodSync(middle, 0o777);
} catch {
}

try {
fs.chmodSync(leaf, 0o777);
} catch {
}
try { fs.chmodSync(middle, 0o777); } catch {}
try { fs.chmodSync(leaf, 0o777); } catch {}

if (!isValidState(fs.existsSync(root), err)) {
throw err;
Expand All @@ -420,15 +399,8 @@ function removeAsync(dir) {
fs.chmodSync(middle, 0o555);

fs.rm(root, { recursive: true }, common.mustCall((err) => {
try {
fs.chmodSync(middle, 0o777);
} catch {
}

try {
fs.chmodSync(leaf, 0o777);
} catch {
}
try { fs.chmodSync(middle, 0o777); } catch {}
try { fs.chmodSync(leaf, 0o777); } catch {}

if (!isValidState(fs.existsSync(root), err)) {
throw err;
Expand Down