From 82c00e6757610cb67fb1caef5726f6efb500ddcd Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 7 Jul 2021 09:34:40 +0100 Subject: [PATCH] Only clean up app tmp dir if it exists during testing --- packages/server/src/utilities/fileSystem/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/server/src/utilities/fileSystem/index.js b/packages/server/src/utilities/fileSystem/index.js index ddda274ef5..afacbf8cdf 100644 --- a/packages/server/src/utilities/fileSystem/index.js +++ b/packages/server/src/utilities/fileSystem/index.js @@ -238,7 +238,10 @@ exports.readFileSync = (filepath, options = "utf8") => { */ exports.cleanup = appIds => { for (let appId of appIds) { - fs.rmdirSync(join(budibaseTempDir(), appId), { recursive: true }) + const path = join(budibaseTempDir(), appId) + if (fs.existsSync(path)) { + fs.rmdirSync(path, { recursive: true }) + } } }