summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/setprofile.py38
1 files changed, 35 insertions, 3 deletions
diff --git a/src/backend/setprofile.py b/src/backend/setprofile.py
index 6219428..5d2f42d 100644
--- a/src/backend/setprofile.py
+++ b/src/backend/setprofile.py
@@ -2,20 +2,52 @@
import animation
import platform
+import signal
import subprocess
+def sigint_handler(signal, frame):
+ sys.exit(0)
+
+
+signal.signal(signal.SIGINT, sigint_handler)
+
+
@animation.wait('setting up profile')
def start():
if platform.uname()[4] == 'x86_64':
e_exe = subprocess.Popen(
['eselect', 'profile', 'set', 'default/linux/amd64/17.1/hardened'])
- e_exe.wait()
+ try:
+ e_exe.wait()
+ except KeyboardInterrupt:
+ e_exe.terminate()
+ try:
+ e_exe.wait(1)
+ except subprocess.TimeoutExpired:
+ e_exe.kill()
+ sys.exit()
if platform.uname()[4] == 'aarch64':
e_exe = subprocess.Popen(
['eselect', 'profile', 'set', 'default/linux/arm64/17.0'])
- e_exe.wait()
+ try:
+ e_exe.wait()
+ except KeyboardInterrupt:
+ e_exe.terminate()
+ try:
+ e_exe.wait(1)
+ except subprocess.TimeoutExpired:
+ e_exe.kill()
+ sys.exit()
env_exe = subprocess.Popen(['env-update'], stdout=subprocess.DEVNULL)
- env_exe.wait()
+ try:
+ env_exe.wait()
+ except KeyboardInterrupt:
+ env_exe.terminate()
+ try:
+ env_exe.wait(1)
+ except subprocess.TimeoutExpired:
+ env_exe.kill()
+ sys.exit()