From 0c7259819319feedf5f272d9f3b1b6c66af82440 Mon Sep 17 00:00:00 2001 From: ratman528 Date: Sat, 11 May 2024 12:37:26 -0500 Subject: [PATCH 1/2] add a graceful way to terminate st-util --- src/st-util/gdb-server.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/st-util/gdb-server.c b/src/st-util/gdb-server.c index 28e0623..41df1fb 100644 --- a/src/st-util/gdb-server.c +++ b/src/st-util/gdb-server.c @@ -92,7 +92,13 @@ static void _cleanup() { static void cleanup(int32_t signum) { printf("Receive signal %i. Exiting...\n", signum); _cleanup(); - exit(1); + // if asked to gracefully terminate + if(signum == SIGTERM){ + // return 0 + exit(0); + }else{ + exit(1); + } (void)signum; } From b67a6c33ca8314e9c366c68ef3d2a3fd6a7eac38 Mon Sep 17 00:00:00 2001 From: AJ528 Date: Mon, 13 May 2024 14:17:42 -0500 Subject: [PATCH 2/2] because signum is now being used, the line "(void)signum;" is no longer needed --- src/st-util/gdb-server.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/st-util/gdb-server.c b/src/st-util/gdb-server.c index 41df1fb..a3ee18a 100644 --- a/src/st-util/gdb-server.c +++ b/src/st-util/gdb-server.c @@ -99,7 +99,6 @@ static void cleanup(int32_t signum) { }else{ exit(1); } - (void)signum; } #if defined(_WIN32)