From ab0e80ec8643f53b22a43304fc7d10f570c7657a Mon Sep 17 00:00:00 2001 From: Menno van Leeuwen Date: Tue, 25 Mar 2025 17:06:47 +0100 Subject: [PATCH] fix: add signal handling for graceful script termination --- bin/dotf | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/dotf b/bin/dotf index 154099b..cd5e282 100755 --- a/bin/dotf +++ b/bin/dotf @@ -1,9 +1,15 @@ #!/usr/bin/env python3 import os -import sys +import signal import subprocess -from pathlib import Path +import sys + +def signal_handler(sig, frame): + print('Exiting.') + sys.exit(0) + +signal.signal(signal.SIGINT, signal_handler) # Script constants DOTFILES_ROOT = os.path.expanduser("~/.dotfiles")