From 4f0d5e526db6080e49eb8e58a4d055dfb974f2e4 Mon Sep 17 00:00:00 2001 From: mg <102437792+mg-dev25@users.noreply.github.com> Date: Tue, 2 Dec 2025 10:33:44 +0100 Subject: [PATCH] Handle SIGTERM and SIGINT for clean exit Adds handlers for SIGTERM and SIGINT signals using the existing sa_usr2() handler, which cleanly exits with YAD_RESPONSE_CANCEL. This allows scripts to properly terminate YAD dialogs when interrupted (Ctrl+C) or when receiving SIGTERM from process managers. Follows feedback from PR #314 about reusing existing handlers instead of creating new ones. --- src/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main.c b/src/main.c index 1bfce7e..62cdce3 100644 --- a/src/main.c +++ b/src/main.c @@ -890,6 +890,8 @@ main (gint argc, gchar ** argv) /* set signal handlers */ signal (SIGUSR1, sa_usr1); signal (SIGUSR2, sa_usr2); + signal (SIGTERM, sa_usr2); /* Clean exit on SIGTERM */ + signal (SIGINT, sa_usr2); /* Clean exit on SIGINT (Ctrl+C) */ #endif if (!is_x11 && options.plug != -1)