Skip to content

Commit d4f2032

Browse files
committed
feat: add default handler for SIGINT
This prevents having a callstack when hitting Ctrl+C in the terminal.
1 parent e23cdce commit d4f2032

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222

2323
- Some signals weren't properly renamed from the previous GTK3 migration (@MightyCreak)
2424
- The syntax menu wasn't working anymore (@MightyCreak)
25+
- Properly handles SIGINT (i.e. Ctrl+C) now (@MightyCreak)
2526

2627
## 0.8.1 - 2023-04-07
2728

src/diffuse/diffuse.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import os
2323
import sys
2424
import gettext
25+
import signal
2526

2627
from gi.repository import Gio
2728

@@ -32,6 +33,10 @@ SYSCONFIGDIR = '@SYSCONFIGDIR@'
3233

3334
sys.path.insert(1, PKGDATADIR)
3435

36+
# Quietly handle SIGINT (i.e. Ctrl+C)
37+
signal.signal(signal.SIGINT, signal.SIG_DFL)
38+
39+
# Initialize i18n
3540
gettext.bindtextdomain('diffuse', localedir=LOCALEDIR)
3641
gettext.textdomain('diffuse')
3742

0 commit comments

Comments
 (0)