fix: exit now works

This commit is contained in:
TopchetoEU 2023-10-07 14:08:47 +03:00
parent a4e5f7f471
commit d2d9fa9738
Signed by: topchetoeu
GPG Key ID: 6531B8583E5F6ED4
2 changed files with 6 additions and 6 deletions

View File

@ -53,6 +53,11 @@ public class Main {
public void error(RuntimeException err) {
Values.printError(err, null);
}
@Override
public void finish() {
task.interrupt();
}
};
public static void main(String args[]) {
@ -96,7 +101,7 @@ public class Main {
catch (EngineException e) { Values.printError(e, ""); }
}
}
catch (InterruptException e) { return; }
catch (IOException e) { return; }
catch (SyntaxException ex) {
if (exited[0]) return;
System.out.println("Syntax error:" + ex.msg);

View File

@ -7,7 +7,6 @@ import me.topchetoeu.jscript.compilation.Instruction;
import me.topchetoeu.jscript.engine.values.FunctionValue;
import me.topchetoeu.jscript.events.Awaitable;
import me.topchetoeu.jscript.events.DataNotifier;
import me.topchetoeu.jscript.exceptions.EngineException;
import me.topchetoeu.jscript.exceptions.InterruptException;
public class Engine {
@ -58,12 +57,8 @@ public class Engine {
try {
task.notifier.next(task.func.call(task.ctx, task.thisArg, task.args));
}
catch (EngineException e) {
task.notifier.error(e);
}
catch (RuntimeException e) {
task.notifier.error(e);
e.printStackTrace();
}
}
private void run() {