fix: add signal handling for graceful script termination
This commit is contained in:
parent
66e0253fdb
commit
ab0e80ec86
10
bin/dotf
10
bin/dotf
@ -1,9 +1,15 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import signal
|
||||||
import subprocess
|
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
|
# Script constants
|
||||||
DOTFILES_ROOT = os.path.expanduser("~/.dotfiles")
|
DOTFILES_ROOT = os.path.expanduser("~/.dotfiles")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user