Utilities: Fix top utility not calling exit() on SIGINT

Before, when running top, pressing Control+C (triggering SIGINT),
would not call the atexit handler. Therefor not restoring stdin.
This commit is contained in:
HawDevelopment 2022-12-27 13:22:01 +01:00 committed by Andreas Kling
parent 058a39c6fc
commit a5dfd5eeb6
Notes: sideshowbarker 2024-07-19 17:00:01 +09:00

View File

@ -203,11 +203,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::unveil("/etc/passwd", "r"));
unveil(nullptr, nullptr);
signal(SIGWINCH, [](int) {
TRY(Core::System::signal(SIGWINCH, [](int) {
g_window_size_changed = true;
});
}));
TRY(Core::System::signal(SIGINT, [](int) {
exit(0);
}));
TRY(Core::System::pledge("stdio rpath tty"));
TopOption top_option;
parse_args(arguments, top_option);