From ee80b4e68036adf7261c5a9141c61c61b8f670fb Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Wed, 12 Apr 2023 19:36:56 +0100 Subject: [PATCH] Exit with code 124 if the process is interrupted eg with C-c. --- src/cpulimit.c | 2 +- src/process_group.c | 1 + tests/process_iterator_test.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cpulimit.c b/src/cpulimit.c index 50eabeac..9492c6ec 100644 --- a/src/cpulimit.c +++ b/src/cpulimit.c @@ -108,7 +108,7 @@ static void quit(int sig) //fix ^C little problem printf("\r"); fflush(stdout); - exit(0); + exit(124); } //return t1-t2 in microseconds (no overflow checks, so better watch out!) diff --git a/src/process_group.c b/src/process_group.c index 06d73a6f..5ef9b477 100644 --- a/src/process_group.c +++ b/src/process_group.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include #include #include diff --git a/tests/process_iterator_test.c b/tests/process_iterator_test.c index 16151967..56e2be6a 100644 --- a/tests/process_iterator_test.c +++ b/tests/process_iterator_test.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include #include #include