From a769db6078a1e70ba38ce606eb61e717b5e04cc7 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Fri, 3 Apr 2020 21:52:49 +0100 Subject: [PATCH] js: Return 1 after exception in non-REPL mode --- Userland/js.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Userland/js.cpp b/Userland/js.cpp index 22f2e2245c..067abc0cee 100644 --- a/Userland/js.cpp +++ b/Userland/js.cpp @@ -380,9 +380,10 @@ int main(int argc, char** argv) printf("Uncaught exception: "); print(interpreter->exception()->value()); interpreter->clear_exception(); - } else if (print_last_result) { - printf("%s\n", result.to_string().characters()); + return 1; } + if (print_last_result) + print(result); } return 0;