diff --git a/lib/utils.js b/lib/utils.js index 3c9ad024e..408600000 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -476,8 +476,12 @@ module.exports.isNotSet = function (obj) { return false } -module.exports.emptyFolder = async directoryPath => { - require('child_process').execSync(`rm -rf ${directoryPath}/*`) +module.exports.emptyFolder = directoryPath => { + // Do not throw on non-existent directory, since it may be created later + if (!fs.existsSync(directoryPath)) return + for (const file of fs.readdirSync(directoryPath)) { + fs.rmSync(path.join(directoryPath, file), { recursive: true, force: true }) + } } module.exports.printObjectProperties = obj => {