added safeguard to ps run

This commit is contained in:
Djeeberjr 2023-05-29 21:10:22 +02:00
parent 563211af6f
commit cb7e284313

View File

@ -1,5 +1,6 @@
package kernel.ps; package kernel.ps;
import kernel.log.Log;
import kernel.ps.ProcessHandle.HandleConfig; import kernel.ps.ProcessHandle.HandleConfig;
using tink.CoreApi; using tink.CoreApi;
@ -12,11 +13,16 @@ class ProcessManager {
public static function run(process:Process, config: HandleConfig):PID { public static function run(process:Process, config: HandleConfig):PID {
var pid = createPID(); var pid = createPID();
var handle = new ProcessHandle(config, pid); var handle = new ProcessHandle(config, pid);
processList.set(pid, handle); 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; return pid;
} }