mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-27 03:39:04 +00:00
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.
This commit is contained in:
parent
e070309258
commit
c8821cf8e0
Notes:
sideshowbarker
2024-07-17 03:30:41 +09:00
Author: https://github.com/awesomekling
Commit: c8821cf8e0
1 changed files with 1 additions and 11 deletions
|
@ -444,12 +444,6 @@ static ErrorOr<void> repl(JS::Realm& realm)
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
static Function<void()> interrupt_interpreter;
|
|
||||||
static void sigint_handler()
|
|
||||||
{
|
|
||||||
interrupt_interpreter();
|
|
||||||
}
|
|
||||||
|
|
||||||
class ReplConsoleClient final : public JS::ConsoleClient {
|
class ReplConsoleClient final : public JS::ConsoleClient {
|
||||||
public:
|
public:
|
||||||
ReplConsoleClient(JS::Console& console)
|
ReplConsoleClient(JS::Console& console)
|
||||||
|
@ -603,7 +597,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
|
|
||||||
signal(SIGINT, [](int) {
|
signal(SIGINT, [](int) {
|
||||||
if (!s_editor->is_editing())
|
if (!s_editor->is_editing())
|
||||||
sigint_handler();
|
exit(0);
|
||||||
s_editor->save_history(s_history_path.to_byte_string());
|
s_editor->save_history(s_history_path.to_byte_string());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -813,10 +807,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
console_object.console().set_client(console_client);
|
console_object.console().set_client(console_client);
|
||||||
g_vm->heap().set_should_collect_on_every_allocation(gc_on_every_allocation);
|
g_vm->heap().set_should_collect_on_every_allocation(gc_on_every_allocation);
|
||||||
|
|
||||||
signal(SIGINT, [](int) {
|
|
||||||
sigint_handler();
|
|
||||||
});
|
|
||||||
|
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
StringView source_name;
|
StringView source_name;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue