-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(test): use new tests with old
find-python.js
- Loading branch information
1 parent
0f499bd
commit cceb6d9
Showing
3 changed files
with
381 additions
and
238 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const fs = require('fs') | ||
const path = require('path') | ||
|
||
/** recursively delete files, symlinks (without following them) and dirs */ | ||
module.exports = function rmRecSync (pth) { | ||
pth = path.normalize(pth) | ||
|
||
rm(pth) | ||
|
||
function rm (pth) { | ||
const pathStat = fs.statSync(pth) | ||
// trick with lstat is used to avoid following symlinks (especially junctions on windows) | ||
if (pathStat.isDirectory() && !fs.lstatSync(pth).isSymbolicLink()) { | ||
fs.readdirSync(pth).forEach((nextPath) => rm(path.join(pth, nextPath))) | ||
fs.rmdirSync(pth) | ||
} else { | ||
fs.unlinkSync(pth) | ||
} | ||
} | ||
} |
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
Oops, something went wrong.