From 40cfa696844b03bae1c44323d140c5f655531c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20G=C3=BCnther?= Date: Fri, 19 Mar 2021 15:10:31 +0100 Subject: [PATCH 1/7] fix cleanUp --- engine/engine.ts | 2 +- engine/runner.ts | 29 ++++++++++---- engine/wikiRunner.ts | 2 +- runners/console/index.ts | 77 ++++++++++++++++++++---------------- runners/katacoda/index.ts | 2 +- runners/vscode/index.ts | 3 +- runners/wikiConsole/index.ts | 2 +- runners/wikiEclipse/index.ts | 2 +- runners/wikiEditor/index.ts | 2 +- runners/wikiVsCode/index.ts | 2 +- 10 files changed, 72 insertions(+), 51 deletions(-) diff --git a/engine/engine.ts b/engine/engine.ts index 08348a58..22b808cb 100644 --- a/engine/engine.ts +++ b/engine/engine.ts @@ -57,7 +57,7 @@ export class Engine { } for (let runnerIndex in this.environment.runners) { - (await this.getRunner(this.environment.runners[runnerIndex])).destroy(this.playbook); + await (await this.getRunner(this.environment.runners[runnerIndex])).destroy(this.playbook); } } diff --git a/engine/runner.ts b/engine/runner.ts index 2d54fa8b..c31f16c4 100644 --- a/engine/runner.ts +++ b/engine/runner.ts @@ -2,6 +2,7 @@ import { RunResult } from "./run_result"; import { Playbook } from "./playbook"; import * as fs from 'fs'; import * as rimraf from 'rimraf'; +import * as path from 'path'; import { RunCommand } from "./run_command"; export abstract class Runner { @@ -97,18 +98,30 @@ export abstract class Runner { } } - destroy(playbook: Playbook): void { + async destroy(playbook: Playbook): Promise { } - protected createFolder(path: string, deleteFolerIfExist: boolean) { - if(fs.existsSync(path)) { + protected createFolder(dirPath: string, deleteFolerIfExist: boolean) { + if(fs.existsSync(dirPath)) { if(deleteFolerIfExist) { - rimraf.sync(path); - fs.mkdirSync(path, { recursive: true }); - } else return path; + let deleteFlag = true; + let timeout = setTimeout(() => { + deleteFlag = false; + }, 60000); + while(fs.existsSync(dirPath) && deleteFlag ) { + try { + rimraf.sync(dirPath); + } catch(e) { + //ignore error + } + } + + clearTimeout(timeout); + fs.mkdirSync(dirPath, { recursive: true }); + } else return dirPath; } - fs.mkdirSync(path, { recursive: true }); - return path; + fs.mkdirSync(dirPath, { recursive: true }); + return dirPath; } commandIsSkippable(command: String): Boolean { diff --git a/engine/wikiRunner.ts b/engine/wikiRunner.ts index dc51c044..44c40bf6 100644 --- a/engine/wikiRunner.ts +++ b/engine/wikiRunner.ts @@ -13,7 +13,7 @@ export abstract class WikiRunner extends Runner { this.outputPathTutorial = this.createFolder(path.join(outputDirectory, playbook.name), true); } - destroy(playbook: Playbook): void { + async destroy(playbook: Playbook): Promise { } diff --git a/runners/console/index.ts b/runners/console/index.ts index dba5be65..f8c953e0 100644 --- a/runners/console/index.ts +++ b/runners/console/index.ts @@ -36,8 +36,8 @@ export class Console extends Runner { this.env = process.env; } - destroy(playbook: Playbook): void { - this.cleanUp(); + async destroy(playbook: Playbook): Promise { + await this.cleanUp(); } runInstallDevonfwIde(runCommand: RunCommand): RunResult { @@ -690,46 +690,53 @@ export class Console extends Runner { return new Promise(resolve => setTimeout(resolve, seconds * 1000)); } - private killAsyncProcesses() { - if(this.asyncProcesses.length > 0) { - psList().then(processes => { - // Get all processes and check if they are child orprocesses of the processes that should be terminated. If so, kill them first. - let killProcessesRecursively = function(processes, processIdToKill) { - let childProcesses = processes.filter(process => { - return process.ppid == processIdToKill; - }); - - if(childProcesses.length > 0) { - childProcesses.forEach(childProcess => { - killProcessesRecursively(processes, childProcess.pid) - }); - } + private async killAsyncProcesses(): Promise { + let killProcessesRecursively = function(processes: psList.ProcessDescriptor[], processIdToKill: number) { + let childProcesses = processes.filter(process => { + return process.ppid == processIdToKill; + }); - process.kill(processIdToKill); + if(childProcesses.length > 0) { + for(let childProcess of childProcesses) { + killProcessesRecursively(processes, childProcess.pid) } + } - this.asyncProcesses.forEach(asyncProcess => { - killProcessesRecursively(processes, asyncProcess.pid); - }); - }).then(() => { - //Check if there are still running processes on the given ports - this.asyncProcesses.forEach(asyncProcess => { - findProcess("port", asyncProcess.port).then((processes) => { - if(processes.length > 0) { - processes.forEach(proc => { - if(proc.name == asyncProcess.name || proc.name == asyncProcess.name + ".exe") { - process.kill(proc.pid); - } - }); + console.log("kill id " + processIdToKill); + process.kill(processIdToKill); + console.log("killed id " + processIdToKill); + } + + console.log("start killAsyncProcesses") + if(this.asyncProcesses.length > 0) { + let processes: psList.ProcessDescriptor[] = Array.from((await psList()).values()); + for(let asyncProcess of this.asyncProcesses) { + killProcessesRecursively(processes, asyncProcess.pid); + } + console.log("after killProcessesRecursively") + + //Check if there are still running processes on the given ports + for(let asyncProcess of this.asyncProcesses) { + let processes: any[] = await findProcess("port", asyncProcess.port); + console.log("kill processes on ports ", asyncProcess, this.environmentName); + if(processes.length > 0) { + for(let proc of processes) { + if(proc.name == asyncProcess.name || proc.name == asyncProcess.name + ".exe") { + console.log("kill id on port " + proc.pid); + let killed = process.kill(proc.pid); + console.log("killed id on port " + proc.pid, killed, asyncProcess); } - }) - }); - }) + } + } + } + console.log("after killing ports") + } + console.log("end killAsyncProcesses") } - private cleanUp(): void { - this.killAsyncProcesses(); + private async cleanUp(): Promise { + await this.killAsyncProcesses(); ConsoleUtils.restoreDevonDirectory(); } } diff --git a/runners/katacoda/index.ts b/runners/katacoda/index.ts index d4c4a797..69261bdd 100644 --- a/runners/katacoda/index.ts +++ b/runners/katacoda/index.ts @@ -51,7 +51,7 @@ export class Katacoda extends Runner { this.assetManager = new KatacodaAssetManager(path.join(this.outputPathTutorial, "assets")); } - destroy(playbook: Playbook): void { + async destroy(playbook: Playbook): Promise { let tutorialDirectoryName = path.basename(playbook.path); this.renderTemplate("intro.md", path.join(this.outputPathTutorial, "intro.md"), { description: playbook.description, tutorialPath: tutorialDirectoryName }); fs.writeFileSync(this.outputPathTutorial + 'finish.md', ""); diff --git a/runners/vscode/index.ts b/runners/vscode/index.ts index 4859a8f8..90e4463d 100644 --- a/runners/vscode/index.ts +++ b/runners/vscode/index.ts @@ -18,6 +18,7 @@ export class VsCode extends Runner { private installVsCodeFlag: boolean = false; init(playbook: Playbook): void { + console.log("init vscode"); ConsoleUtils.createBackupDevonDirectory(); this.createFolder(path.join(__dirname, "resources"), false); @@ -33,7 +34,7 @@ export class VsCode extends Runner { }); } - destroy(playbook: Playbook): void { + async destroy(playbook: Playbook): Promise { this.cleanUp(); } diff --git a/runners/wikiConsole/index.ts b/runners/wikiConsole/index.ts index 63d25108..9df53d0c 100644 --- a/runners/wikiConsole/index.ts +++ b/runners/wikiConsole/index.ts @@ -10,7 +10,7 @@ export class WikiConsole extends WikiRunner { super.init(playbook); } - destroy(playbook: Playbook): void { + async destroy(playbook: Playbook): Promise { super.destroy(playbook); } diff --git a/runners/wikiEclipse/index.ts b/runners/wikiEclipse/index.ts index d874b053..34eca9d8 100644 --- a/runners/wikiEclipse/index.ts +++ b/runners/wikiEclipse/index.ts @@ -7,7 +7,7 @@ export class WikiEclipse extends WikiRunner { super.init(playbook); } - destroy(playbook: Playbook): void { + async destroy(playbook: Playbook): Promise { super.destroy(playbook); } } \ No newline at end of file diff --git a/runners/wikiEditor/index.ts b/runners/wikiEditor/index.ts index 08fe4e16..4b3838a6 100644 --- a/runners/wikiEditor/index.ts +++ b/runners/wikiEditor/index.ts @@ -7,7 +7,7 @@ export class WikiEditor extends WikiRunner { super.init(playbook); } - destroy(playbook: Playbook): void { + async destroy(playbook: Playbook): Promise { super.destroy(playbook); } } \ No newline at end of file diff --git a/runners/wikiVsCode/index.ts b/runners/wikiVsCode/index.ts index 550adae9..3eef6efa 100644 --- a/runners/wikiVsCode/index.ts +++ b/runners/wikiVsCode/index.ts @@ -7,7 +7,7 @@ export class WikiVsCode extends WikiRunner { super.init(playbook); } - destroy(playbook: Playbook): void { + async destroy(playbook: Playbook): Promise { super.destroy(playbook); } } \ No newline at end of file From b68a408f99bef680733a08a75adc97f2dea9ec89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20G=C3=BCnther?= Date: Sat, 20 Mar 2021 12:17:12 +0100 Subject: [PATCH 2/7] added timeout for folder deletion --- engine/runner.ts | 11 +++---- runners/console/index.ts | 65 +++++++++++++++++++--------------------- 2 files changed, 35 insertions(+), 41 deletions(-) diff --git a/engine/runner.ts b/engine/runner.ts index c31f16c4..da6a43bf 100644 --- a/engine/runner.ts +++ b/engine/runner.ts @@ -104,19 +104,16 @@ export abstract class Runner { protected createFolder(dirPath: string, deleteFolerIfExist: boolean) { if(fs.existsSync(dirPath)) { if(deleteFolerIfExist) { - let deleteFlag = true; - let timeout = setTimeout(() => { - deleteFlag = false; - }, 60000); - while(fs.existsSync(dirPath) && deleteFlag ) { + let timeout = new Date(new Date().getTime() + 180000); //add 3 minutes + console.log("before loop", new Date().toString()) + while(fs.existsSync(dirPath) && new Date() < timeout) { try { rimraf.sync(dirPath); } catch(e) { //ignore error } } - - clearTimeout(timeout); + console.log("after loop", new Date().toString()); fs.mkdirSync(dirPath, { recursive: true }); } else return dirPath; } diff --git a/runners/console/index.ts b/runners/console/index.ts index f8c953e0..68a087fa 100644 --- a/runners/console/index.ts +++ b/runners/console/index.ts @@ -361,7 +361,7 @@ export class Console extends Runner { assert.directoryExits(path.join(this.getWorkingDirectory(), "devonfw", "software", tool)); } } catch(error) { - this.cleanUp(); + await this.cleanUp(); throw error; } } @@ -379,7 +379,7 @@ export class Console extends Runner { .fileExits(path.join(this.getWorkingDirectory(), "devonfw", "software", "cobigen-cli", "cobigen.jar")) .fileExits(path.join(this.getWorkingDirectory(), "devonfw", "software", "cobigen-cli", "cobigen")); } catch(error) { - this.cleanUp(); + await this.cleanUp(); throw error; } } @@ -393,7 +393,7 @@ export class Console extends Runner { .directoryExits(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0], "core", "target")) .directoryExits(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0], "server", "target")); } catch(error) { - this.cleanUp(); + await this.cleanUp(); throw error; } } @@ -405,7 +405,7 @@ export class Console extends Runner { .noException(result) .fileExits(path.join(this.getWorkingDirectory(), "devonfw", "workspaces", "main", runCommand.command.parameters[0])); } catch(error) { - this.cleanUp(); + await this.cleanUp(); throw error; } } @@ -423,7 +423,7 @@ export class Console extends Runner { .directoryExits(path.join(workspaceDir, runCommand.command.parameters[0], "server", "src", "main", "java")) .fileExits(path.join(workspaceDir, runCommand.command.parameters[0], "core", "src", "main", "java", "com", "example", "application", runCommand.command.parameters[0], "SpringBootApp.java")); } catch(error) { - this.cleanUp(); + await this.cleanUp(); throw error; } } @@ -435,7 +435,7 @@ export class Console extends Runner { .noException(result) .fileExits(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0])); } catch(error) { - this.cleanUp(); + await this.cleanUp(); throw error; } } @@ -456,7 +456,7 @@ export class Console extends Runner { .fileExits(filepath) .fileContains(filepath, content); } catch(error) { - this.cleanUp(); + await this.cleanUp(); throw error; } } @@ -475,18 +475,18 @@ export class Console extends Runner { await this.sleep(runCommand.command.parameters[1].startupTime); if(!runCommand.command.parameters[1].port) { - this.killAsyncProcesses(); + await this.killAsyncProcesses(); throw new Error("Missing arguments for command dockerCompose. You have to specify a port and a path for the server. For further information read the function documentation."); } else { let isReachable = await assert.serverIsReachable(runCommand.command.parameters[1].port, runCommand.command.parameters[1].path); if(!isReachable) { - this.killAsyncProcesses(); + await this.killAsyncProcesses(); throw new Error("The server has not become reachable in " + startupTimeInSeconds + " seconds: " + "http://localhost:" + runCommand.command.parameters[1].port + "/" + runCommand.command.parameters[1].path); } } } } catch(error) { - this.cleanUp(); + await this.cleanUp(); throw error; } } @@ -505,18 +505,18 @@ export class Console extends Runner { await this.sleep(runCommand.command.parameters[1].startupTime); if(!runCommand.command.parameters[1].port || !runCommand.command.parameters[1].path) { - this.killAsyncProcesses(); + await this.killAsyncProcesses(); throw new Error("Missing arguments for command runServerJava. You have to specify a port and a path for the server. For further information read the function documentation."); } else { let isReachable = await assert.serverIsReachable(runCommand.command.parameters[1].port, runCommand.command.parameters[1].path); if(!isReachable) { - this.killAsyncProcesses(); + await this.killAsyncProcesses(); throw new Error("The server has not become reachable in " + startupTimeInSeconds + " seconds: " + "http://localhost:" + runCommand.command.parameters[1].port + "/" + runCommand.command.parameters[1].path) } } } } catch(error) { - this.cleanUp(); + await this.cleanUp(); throw error; } } @@ -534,7 +534,7 @@ export class Console extends Runner { .directoryNotEmpty(path.join(this.getVariable(this.workspaceDirectory), runCommand.command.parameters[0], repoName)) .repositoryIsClean(directorypath); } catch(error) { - this.cleanUp(); + await this.cleanUp(); throw error; } } @@ -552,7 +552,7 @@ export class Console extends Runner { .directoryNotEmpty(path.join(projectDir, "node_modules")); } } catch(error) { - this.cleanUp(); + await this.cleanUp(); throw error; } } @@ -570,7 +570,7 @@ export class Console extends Runner { .directoryNotEmpty(directory) .fileExits(path.join(directory, runCommand.command.parameters[1])); } catch(error) { - this.cleanUp(); + await this.cleanUp(); throw error; } } @@ -589,18 +589,18 @@ export class Console extends Runner { await this.sleep(runCommand.command.parameters[1].startupTime); if(!runCommand.command.parameters[1].port) { - this.killAsyncProcesses(); + await this.killAsyncProcesses(); throw new Error("Missing arguments for command runClientNg. You have to specify a port for the server. For further information read the function documentation."); } else { let isReachable = await assert.serverIsReachable(runCommand.command.parameters[1].port, runCommand.command.parameters[1].path); if(!isReachable) { - this.killAsyncProcesses(); + await this.killAsyncProcesses(); throw new Error("The server has not become reachable in " + startupTimeInSeconds + " seconds: " + "http://localhost:" + runCommand.command.parameters[1].port + "/" + runCommand.command.parameters[1].path) } } } } catch(error) { - this.cleanUp(); + await this.cleanUp(); throw error; } } @@ -625,7 +625,7 @@ export class Console extends Runner { .directoryNotEmpty(path.join(projectPath, outputpath)); } catch(error) { - this.cleanUp(); + await this.cleanUp(); throw error; } } @@ -638,7 +638,7 @@ export class Console extends Runner { .noException(result) .directoryExits(folderPath); } catch(error) { - this.cleanUp(); + await this.cleanUp(); throw error; } } @@ -653,7 +653,7 @@ export class Console extends Runner { .directoryNotEmpty(templatesDir); } catch(error) { - this.cleanUp(); + await this.cleanUp(); throw error; } } @@ -667,7 +667,7 @@ export class Console extends Runner { .directoryExits(projectDir) .directoryNotEmpty(projectDir); } catch(error) { - this.cleanUp(); + await this.cleanUp(); throw error; } } @@ -702,18 +702,18 @@ export class Console extends Runner { } } - console.log("kill id " + processIdToKill); - process.kill(processIdToKill); - console.log("killed id " + processIdToKill); + try { + process.kill(processIdToKill); + } catch(e) { + console.error("Error killing id " + processIdToKill, e); + } } - console.log("start killAsyncProcesses") if(this.asyncProcesses.length > 0) { let processes: psList.ProcessDescriptor[] = Array.from((await psList()).values()); for(let asyncProcess of this.asyncProcesses) { killProcessesRecursively(processes, asyncProcess.pid); } - console.log("after killProcessesRecursively") //Check if there are still running processes on the given ports for(let asyncProcess of this.asyncProcesses) { @@ -723,16 +723,13 @@ export class Console extends Runner { for(let proc of processes) { if(proc.name == asyncProcess.name || proc.name == asyncProcess.name + ".exe") { console.log("kill id on port " + proc.pid); - let killed = process.kill(proc.pid); - console.log("killed id on port " + proc.pid, killed, asyncProcess); + process.kill(proc.pid); + console.log("killed id on port " + proc.pid, asyncProcess); } } } - } - console.log("after killing ports") - + } } - console.log("end killAsyncProcesses") } private async cleanUp(): Promise { From 7dc406399064530613d3762b55b9fd23b79e22c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20G=C3=BCnther?= Date: Sat, 20 Mar 2021 12:27:41 +0100 Subject: [PATCH 3/7] removed unused lines --- engine/runner.ts | 1 - runners/vscode/index.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/engine/runner.ts b/engine/runner.ts index da6a43bf..de3f82d3 100644 --- a/engine/runner.ts +++ b/engine/runner.ts @@ -2,7 +2,6 @@ import { RunResult } from "./run_result"; import { Playbook } from "./playbook"; import * as fs from 'fs'; import * as rimraf from 'rimraf'; -import * as path from 'path'; import { RunCommand } from "./run_command"; export abstract class Runner { diff --git a/runners/vscode/index.ts b/runners/vscode/index.ts index 90e4463d..9c738fd3 100644 --- a/runners/vscode/index.ts +++ b/runners/vscode/index.ts @@ -18,7 +18,6 @@ export class VsCode extends Runner { private installVsCodeFlag: boolean = false; init(playbook: Playbook): void { - console.log("init vscode"); ConsoleUtils.createBackupDevonDirectory(); this.createFolder(path.join(__dirname, "resources"), false); From f50d1be1272d28ff09e10cb91281ec3101f52cf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20G=C3=BCnther?= Date: Sat, 20 Mar 2021 12:49:19 +0100 Subject: [PATCH 4/7] refactoring --- engine/runner.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/engine/runner.ts b/engine/runner.ts index de3f82d3..0d1c94ee 100644 --- a/engine/runner.ts +++ b/engine/runner.ts @@ -100,24 +100,24 @@ export abstract class Runner { async destroy(playbook: Playbook): Promise { } - protected createFolder(dirPath: string, deleteFolerIfExist: boolean) { - if(fs.existsSync(dirPath)) { - if(deleteFolerIfExist) { + protected createFolder(path: string, deleteFolderIfExist: boolean) { + if(fs.existsSync(path)) { + if(deleteFolderIfExist) { let timeout = new Date(new Date().getTime() + 180000); //add 3 minutes console.log("before loop", new Date().toString()) - while(fs.existsSync(dirPath) && new Date() < timeout) { + while(fs.existsSync(path) && new Date() < timeout) { try { - rimraf.sync(dirPath); + rimraf.sync(path); } catch(e) { //ignore error } } console.log("after loop", new Date().toString()); - fs.mkdirSync(dirPath, { recursive: true }); - } else return dirPath; + fs.mkdirSync(path, { recursive: true }); + } else return path; } - fs.mkdirSync(dirPath, { recursive: true }); - return dirPath; + fs.mkdirSync(path, { recursive: true }); + return path; } commandIsSkippable(command: String): Boolean { From c3bab000c51cc34af09eae189df836e05061c218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20G=C3=BCnther?= Date: Mon, 22 Mar 2021 08:38:17 +0100 Subject: [PATCH 5/7] removed debug messages --- engine/runner.ts | 5 +---- runners/console/index.ts | 9 +++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/engine/runner.ts b/engine/runner.ts index 0d1c94ee..10ac39b3 100644 --- a/engine/runner.ts +++ b/engine/runner.ts @@ -103,8 +103,7 @@ export abstract class Runner { protected createFolder(path: string, deleteFolderIfExist: boolean) { if(fs.existsSync(path)) { if(deleteFolderIfExist) { - let timeout = new Date(new Date().getTime() + 180000); //add 3 minutes - console.log("before loop", new Date().toString()) + let timeout = new Date(new Date().getTime() + 180000); //timeout after 3 minutes while(fs.existsSync(path) && new Date() < timeout) { try { rimraf.sync(path); @@ -112,8 +111,6 @@ export abstract class Runner { //ignore error } } - console.log("after loop", new Date().toString()); - fs.mkdirSync(path, { recursive: true }); } else return path; } fs.mkdirSync(path, { recursive: true }); diff --git a/runners/console/index.ts b/runners/console/index.ts index 68a087fa..d72f9b6b 100644 --- a/runners/console/index.ts +++ b/runners/console/index.ts @@ -718,13 +718,14 @@ export class Console extends Runner { //Check if there are still running processes on the given ports for(let asyncProcess of this.asyncProcesses) { let processes: any[] = await findProcess("port", asyncProcess.port); - console.log("kill processes on ports ", asyncProcess, this.environmentName); if(processes.length > 0) { for(let proc of processes) { if(proc.name == asyncProcess.name || proc.name == asyncProcess.name + ".exe") { - console.log("kill id on port " + proc.pid); - process.kill(proc.pid); - console.log("killed id on port " + proc.pid, asyncProcess); + try { + process.kill(proc.pid); + } catch(e) { + console.error("Error killing id " + proc.pid, e); + } } } } From 189d35817a0e979ee87a826361a062a3ffdda004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20G=C3=BCnther?= Date: Mon, 22 Mar 2021 12:53:00 +0100 Subject: [PATCH 6/7] removed loop --- engine/runner.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/engine/runner.ts b/engine/runner.ts index 10ac39b3..90a58484 100644 --- a/engine/runner.ts +++ b/engine/runner.ts @@ -103,12 +103,11 @@ export abstract class Runner { protected createFolder(path: string, deleteFolderIfExist: boolean) { if(fs.existsSync(path)) { if(deleteFolderIfExist) { - let timeout = new Date(new Date().getTime() + 180000); //timeout after 3 minutes - while(fs.existsSync(path) && new Date() < timeout) { + if(fs.existsSync(path)) { try { rimraf.sync(path); } catch(e) { - //ignore error + console.log("Error deleting foler " + path, e); } } } else return path; From 342657c19e21bb293ca5b530807a07763fbf60f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20G=C3=BCnther?= Date: Mon, 22 Mar 2021 12:54:14 +0100 Subject: [PATCH 7/7] removed loop --- engine/runner.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/engine/runner.ts b/engine/runner.ts index 90a58484..2e49f325 100644 --- a/engine/runner.ts +++ b/engine/runner.ts @@ -103,12 +103,10 @@ export abstract class Runner { protected createFolder(path: string, deleteFolderIfExist: boolean) { if(fs.existsSync(path)) { if(deleteFolderIfExist) { - if(fs.existsSync(path)) { - try { - rimraf.sync(path); - } catch(e) { - console.log("Error deleting foler " + path, e); - } + try { + rimraf.sync(path); + } catch(e) { + console.log("Error deleting foler " + path, e); } } else return path; }