BIG FORMATING COMMIT

This commit is contained in:
2023-07-30 15:55:22 +02:00
parent 088fce0aaa
commit 91972107eb
103 changed files with 1610 additions and 1585 deletions

View File

@@ -8,26 +8,26 @@ using tink.CoreApi;
typedef PID = Int;
class ProcessManager {
private static final processList = new Map<PID,ProcessHandle>();
private static final processList = new Map<PID, ProcessHandle>();
public static function run(process:Process, config: HandleConfig):PID {
public static function run(process:Process, config:HandleConfig):PID {
var pid = createPID();
var handle = new ProcessHandle(config, pid);
processList.set(pid, handle);
try{
try {
process.run(handle);
}catch(e:Dynamic){
} catch (e:Dynamic) {
Log.error("Error while running process: " + e);
handle.close(false);
}
return pid;
}
public static function kill(pid: PID) {
if (!processList.exists(pid)){
public static function kill(pid:PID) {
if (!processList.exists(pid)) {
Log.warn("Trying to kill non-existing process: " + pid);
return;
}
@@ -37,7 +37,7 @@ class ProcessManager {
handle.close();
}
private static function createPID(): PID {
private static function createPID():PID {
// TODO: better PID generation
// generate a random PID
@@ -45,7 +45,7 @@ class ProcessManager {
}
@:allow(kernel.ui.WindowManager)
private static function getProcess(pid:PID):Null<ProcessHandle>{
private static function getProcess(pid:PID):Null<ProcessHandle> {
return processList.get(pid);
}