Skip to content

Commit

Permalink
fix: set maxRetries when calling fs.rmSync
Browse files Browse the repository at this point in the history
This makes it more resilient against random failure.

See nodejs/node#54561
  • Loading branch information
aleclarson committed Nov 22, 2024
1 parent 439b26f commit 4f17dc9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ export async function stop(dataDir: string, options: StopOptions = {}) {
console.log('removing data directory...')
}
rmSync(path.dirname(dataDir), {
maxRetries: 3,
recursive: true,
force: true,
})
Expand Down
6 changes: 5 additions & 1 deletion test/mod.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ describe('initdb', () => {
afterAll(async () => {
const cwd = os.tmpdir()
for (const dir of fs.globSync(PREFIX + '*', { cwd })) {
fs.rmSync(path.join(cwd, dir), { recursive: true })
fs.rmSync(path.join(cwd, dir), {
maxRetries: 3,
recursive: true,
force: true,
})
}
})

Expand Down

0 comments on commit 4f17dc9

Please sign in to comment.