Add process manager
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
__oskrnl.console_log("> ");
|
||||
|
||||
var input = "";
|
||||
var inputActive = true;
|
||||
var pid = "";
|
||||
|
||||
__oskrnl.input_onKeyPress(function (key) {
|
||||
if (!inputActive) return;
|
||||
__oskrnl.input_onKeyPress(__oskrnl_procd_pid, function (key) {
|
||||
if (pid != "" && __oskrnl.app_proc_running(pid)) return;
|
||||
|
||||
if (key == "Backspace") input = input.slice(0, -1);
|
||||
else if (key == "Enter") {
|
||||
inputActive = false;
|
||||
process();
|
||||
return;
|
||||
} else input += key.toLowerCase();
|
||||
@@ -19,5 +18,14 @@ __oskrnl.input_onKeyPress(function (key) {
|
||||
function process() {
|
||||
var app = input.split(" ")[0];
|
||||
var args = input.split(" ").slice(1);
|
||||
__oskrnl.app_launcher_run(app, args.join(" "));
|
||||
pid = __oskrnl.app_launcher_run(app, args.join(" "));
|
||||
__oskrnl.app_proc_addExitListener(pid, function () {
|
||||
input = "";
|
||||
__oskrnl.console_log("> ");
|
||||
});
|
||||
|
||||
if (!__oskrnl.app_proc_running(pid)) {
|
||||
input = "";
|
||||
__oskrnl.console_log("> ");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user