From abcdc67d79f6d89ac6997402955949e3d5aabe15 Mon Sep 17 00:00:00 2001 From: Stefan Mertl Date: Wed, 31 Jan 2018 16:16:11 +0100 Subject: [PATCH] Exit after handling the signal. Handle the SIGINT signal as well. --- software/c++/ruwaicom/src/ruwaicom.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/software/c++/ruwaicom/src/ruwaicom.cpp b/software/c++/ruwaicom/src/ruwaicom.cpp index ae56733..a8f8209 100644 --- a/software/c++/ruwaicom/src/ruwaicom.cpp +++ b/software/c++/ruwaicom/src/ruwaicom.cpp @@ -27,7 +27,7 @@ void handle_sig_term(int signum) { - if (signum == SIGTERM) + if ((signum == SIGTERM) || (signum == SIGINT)) { LCDDisplay display = LCDDisplay(66, 67, 45, 23, 47, 27); display.init(); @@ -36,12 +36,14 @@ handle_sig_term(int signum) display.print("STOPPED", "RUWAICOM"); } + std::exit(signum) } int main(int argc, char* argv[]) { signal(SIGTERM, handle_sig_term); + signal(SIGINT, handle_sig_term); std::string config_file = ""; std::string debug_level = ""; if (argc != 2) -- 2.11.4.GIT