diff --git a/lib/utils.js b/lib/utils.js index 9074f07ce..71e3df86d 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -448,7 +448,11 @@ export const isNotSet = function (obj) { } export const emptyFolder = async directoryPath => { - childProcess.execSync(`rm -rf ${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 }) + } } export const printObjectProperties = obj => {