On SIGINT, raise signal again.

When SIGINT is intercepted, quit the run loop and raise the signal
again.

I am not sure this addresses:
https://github.com/ArthurSonzogni/FTXUI/issues/117
Maybe?
This commit is contained in:
ArthurSonzogni 2021-06-19 18:44:43 +02:00 committed by Arthur Sonzogni
parent 18d1b04b7a
commit 478d7e8bca

View File

@ -205,9 +205,7 @@ void OnExit(int signal) {
on_exit_functions.top()();
on_exit_functions.pop();
}
if (signal == SIGINT)
std::exit(SIGINT);
std::raise(signal);
}
auto install_signal_handler = [](int sig, SignalHandler handler) {
@ -278,6 +276,8 @@ CapturedMouse ScreenInteractive::CaptureMouse() {
}
void ScreenInteractive::Loop(Component component) {
on_exit_functions.push([this] { ExitLoopClosure()(); });
// Install a SIGINT handler and restore the old handler on exit.
auto old_sigint_handler = std::signal(SIGINT, OnExit);
on_exit_functions.push(