mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-07 19:51:51 +09:00
prawwper app crash handling on command.js
This commit is contained in:
@@ -397,20 +397,7 @@ var execApp = (cmdsrc, args) => {
|
||||
`var _appStub=function(exec_args){${injectIntChk(cmdsrc, intchkFunName)}\n};` +
|
||||
`_appStub`); // making 'exec_args' a app-level global
|
||||
|
||||
try {
|
||||
execAppPrg(args);
|
||||
}
|
||||
catch (e) {
|
||||
printerrln(
|
||||
`
|
||||
\\|/ ____ \\|/
|
||||
"@'/ ,. \\'@"
|
||||
/_| \\__/ |_\\
|
||||
\\__U_/
|
||||
Kernel panic - ${e.stack}`
|
||||
)
|
||||
serial.printerr(e.stack)
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -419,4 +406,5 @@ serial.printerr(e.stack)
|
||||
serial.println("TVDOS.SYS initialised, running boot script...");
|
||||
var _G = {};
|
||||
filesystem.open("A", "tvdos/bin/command.js", "R");
|
||||
execApp(filesystem.readAll("A"), ["", "/c", "\\AUTOEXEC.BAT"]);
|
||||
eval(`var _appStub=function(exec_args){${filesystem.readAll("A")}\n};` +
|
||||
`_appStub`)(["", "/c", "\\AUTOEXEC.BAT"])
|
||||
|
||||
@@ -378,9 +378,9 @@ shell.coreutils = {
|
||||
// TODO just print out what's there
|
||||
print(contents);
|
||||
},
|
||||
/*panic: function(args) {
|
||||
throw Error("Artificial Kernel Panic Triggered")
|
||||
}*/
|
||||
panic: function(args) {
|
||||
throw Error("Panicking command.js")
|
||||
}
|
||||
};
|
||||
shell.coreutils.chdir = shell.coreutils.cd;
|
||||
Object.freeze(shell.coreutils);
|
||||
@@ -530,6 +530,7 @@ shell.execute = function(line) {
|
||||
gotError = true;
|
||||
|
||||
serial.printerr(`[command.js] program quit with ${e}:\n${e.stack || '(stack trace unavailable)'}`);
|
||||
printerrln(`Program quit with error:\n${e.stack || '(stack trace unavailable)'}`);
|
||||
|
||||
if (`${e}`.startsWith("InterruptedException"))
|
||||
errorlevel = SIGTERM.name;
|
||||
|
||||
Reference in New Issue
Block a user