Skip to content

Commit

Permalink
refactor(src/cli/cli.cc): delay exit in signal
Browse files Browse the repository at this point in the history
  • Loading branch information
jwerle committed Dec 9, 2024
1 parent b28d3aa commit 3d5db07
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/cli/cli.cc
Original file line number Diff line number Diff line change
Expand Up @@ -795,21 +795,23 @@ void signalHandler (int signum) {

if (appStatus == -1) {
appStatus = signum;
log("App result: " + std::to_string(signum));
log("App result (signal): " + std::to_string(signum));
}

if (signum == SIGTERM || signum == SIGINT) {
#if SOCKET_RUNTIME_PLATFORM_LINUX
while (wait(NULL) != -1 || errno == EINTR);
#endif
signal(signum, SIG_DFL);
raise(signum);
}

#if SOCKET_RUNTIME_PLATFORM_LINUX
msleep(500);
if (gtk_main_level() > 0) {
g_main_context_invoke(
nullptr,
+[](gpointer userData) -> gboolean {
msleep(16);
msleep(1000);
gtk_main_quit();
return true;
},
Expand Down

0 comments on commit 3d5db07

Please sign in to comment.