Re-add Linux signal handler that was lost when rebasing Windows service main.cpp rework
This commit is contained in:
parent
a3acd6bda5
commit
3db4ea30a3
1 changed files with 23 additions and 0 deletions
|
|
@ -20,6 +20,23 @@
|
||||||
#include "macutils.h"
|
#include "macutils.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
#include <csignal>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/******************************************************************************************\
|
||||||
|
* *
|
||||||
|
* Linux signal handler *
|
||||||
|
* *
|
||||||
|
\******************************************************************************************/
|
||||||
|
#ifdef __linux__
|
||||||
|
void sigHandler(int s)
|
||||||
|
{
|
||||||
|
std::signal(s, SIG_DFL);
|
||||||
|
qApp->quit();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/******************************************************************************************\
|
/******************************************************************************************\
|
||||||
* *
|
* *
|
||||||
* startup *
|
* startup *
|
||||||
|
|
@ -105,6 +122,12 @@ int startup(int argc, char* argv[], unsigned int ret_flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_TRACE("[main] Ready to exec() the dialog");
|
LOG_TRACE("[main] Ready to exec() the dialog");
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
std::signal(SIGINT, sigHandler);
|
||||||
|
std::signal(SIGTERM, sigHandler);
|
||||||
|
#endif
|
||||||
|
|
||||||
exitval = a.exec();
|
exitval = a.exec();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue