From cb7e2843135fd40fd53e96882dae441aab46b016 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Mon, 29 May 2023 21:10:22 +0200 Subject: [PATCH] added safeguard to ps run --- src/kernel/ps/ProcessManager.hx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/kernel/ps/ProcessManager.hx b/src/kernel/ps/ProcessManager.hx index 7001ea7..a5ca3e6 100644 --- a/src/kernel/ps/ProcessManager.hx +++ b/src/kernel/ps/ProcessManager.hx @@ -1,5 +1,6 @@ package kernel.ps; +import kernel.log.Log; import kernel.ps.ProcessHandle.HandleConfig; using tink.CoreApi; @@ -12,11 +13,16 @@ class ProcessManager { public static function run(process:Process, config: HandleConfig):PID { var pid = createPID(); var handle = new ProcessHandle(config, pid); - + processList.set(pid, handle); - - process.run(handle); - + + try{ + process.run(handle); + }catch(e:Dynamic){ + Log.error("Error while running process: " + e); + handle.close(false); + } + return pid; }