Handle signal interrupts explicitly in sparkd

Otherwise the python interpretter, which is instantiated when we load
python md plugins, prevents the application from exiting.
This commit is contained in:
John Colvin committed 2024-09-18 14:02:39 +00:00
1 parent 2e9b4c78f3
commit 06a80040ff
1 file changed
+8
+8
View File
@@ -11,10 +11,18 @@
#include "sparkd/cmds/crypto/CryptoCmd.h"
#include <CLI11/CLI11.hpp>
#include <csignal>
using namespace bts;
void signal_handler(int signum) {
std::cerr << "Interrupt signal (" << signum << "). Exiting" << std::endl;
exit(signum);
}
int main(int argc, char **argv) {
std::signal(SIGINT, signal_handler);
std::signal(SIGTERM, signal_handler);
utils::SparkLibInit init;
// The catch testing framework has its own command line parser so