From c8821cf8e021b4cb004bfd01f37e35e40c332560 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 4 May 2024 13:56:13 +0200 Subject: [PATCH] js: Don't try to call a null Function on SIGINT This stops `js` from asserting when pressing ^C in the middle of executing a long-running script. --- Userland/Utilities/js.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp index 1bc582339b7..a08fb37a3fe 100644 --- a/Userland/Utilities/js.cpp +++ b/Userland/Utilities/js.cpp @@ -444,12 +444,6 @@ static ErrorOr repl(JS::Realm& realm) return {}; } -static Function interrupt_interpreter; -static void sigint_handler() -{ - interrupt_interpreter(); -} - class ReplConsoleClient final : public JS::ConsoleClient { public: ReplConsoleClient(JS::Console& console) @@ -603,7 +597,7 @@ ErrorOr serenity_main(Main::Arguments arguments) signal(SIGINT, [](int) { if (!s_editor->is_editing()) - sigint_handler(); + exit(0); s_editor->save_history(s_history_path.to_byte_string()); }); @@ -813,10 +807,6 @@ ErrorOr serenity_main(Main::Arguments arguments) console_object.console().set_client(console_client); g_vm->heap().set_should_collect_on_every_allocation(gc_on_every_allocation); - signal(SIGINT, [](int) { - sigint_handler(); - }); - StringBuilder builder; StringView source_name;