This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: clean repo func on windows (#2243)
`rimraf.sync` does not retry when it encounters errors on windows. The async version retries a number of times before failing. See isaacs/rimraf#72 for context on why rimraf on windows might error. License: MIT Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
- Loading branch information
Alan Shaw
authored
Jul 12, 2019
1 parent
04aa63c
commit 26b92a1
Showing
4 changed files
with
10 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
'use strict' | ||
|
||
const rimraf = require('rimraf') | ||
const fs = require('fs') | ||
const fs = require('fs').promises | ||
const { promisify } = require('util') | ||
|
||
module.exports = (dir) => { | ||
module.exports = async dir => { | ||
try { | ||
fs.accessSync(dir) | ||
await fs.access(dir) | ||
} catch (err) { | ||
// Does not exist so all good | ||
return | ||
} | ||
|
||
rimraf.sync(dir) | ||
return promisify(rimraf)(dir) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters