We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
emptyFolder
1 parent 53a5a97 commit f58de8dCopy full SHA for f58de8d
lib/utils.js
@@ -457,7 +457,11 @@ module.exports.isNotSet = function (obj) {
457
};
458
459
module.exports.emptyFolder = (directoryPath) => {
460
- require('child_process').execSync(`rm -rf ${directoryPath}/*`);
+ // Do not throw on non-existent directory, since it may be created later
461
+ if (!fs.existsSync(directoryPath)) return;
462
+ for (const file of fs.readdirSync(directoryPath)) {
463
+ fs.rmSync(path.join(directoryPath, file), { recursive: true, force: true });
464
+ }
465
466
467
module.exports.printObjectProperties = (obj) => {
0 commit comments