prawwper app crash handling on command.js

This commit is contained in:
minjaesong
2022-05-31 00:35:23 +09:00
parent 9aaa7689ed
commit 12cece8784
2 changed files with 6 additions and 17 deletions

View File

@@ -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"])

View File

@@ -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;