From d4f203297264c84827103de890319d7ef9770318 Mon Sep 17 00:00:00 2001 From: Romain Failliot Date: Sat, 8 Apr 2023 14:09:53 -0400 Subject: [PATCH] feat: add default handler for SIGINT This prevents having a callstack when hitting Ctrl+C in the terminal. --- CHANGELOG.md | 1 + src/diffuse/diffuse.in | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1582c0b..e30422a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Some signals weren't properly renamed from the previous GTK3 migration (@MightyCreak) - The syntax menu wasn't working anymore (@MightyCreak) +- Properly handles SIGINT (i.e. Ctrl+C) now (@MightyCreak) ## 0.8.1 - 2023-04-07 diff --git a/src/diffuse/diffuse.in b/src/diffuse/diffuse.in index 7f405a6..b1f3742 100755 --- a/src/diffuse/diffuse.in +++ b/src/diffuse/diffuse.in @@ -22,6 +22,7 @@ import os import sys import gettext +import signal from gi.repository import Gio @@ -32,6 +33,10 @@ SYSCONFIGDIR = '@SYSCONFIGDIR@' sys.path.insert(1, PKGDATADIR) +# Quietly handle SIGINT (i.e. Ctrl+C) +signal.signal(signal.SIGINT, signal.SIG_DFL) + +# Initialize i18n gettext.bindtextdomain('diffuse', localedir=LOCALEDIR) gettext.textdomain('diffuse')