From 00dd96bbd3217c636c7844233ff47b6711fd9496 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
Date: Wed, 15 Mar 2023 11:34:30 +0200
Subject: [PATCH] Fixed for KeyboardInterrupt

---
 ChangeLog.txt         | 1 +
 slpkg/progress_bar.py | 9 ++++++---
 slpkg/slackbuild.py   | 9 ++++++---
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/ChangeLog.txt b/ChangeLog.txt
index 7cf0233f..a908d116 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -6,6 +6,7 @@ Updated:
 Fixed:
 - Summary for upgrade packages
 - Downloader for KeyboardInterrupt
+- Build and install for KeyboardInterrupt
 
 BugFixed:
 - Default build path /tmp/slpkg/build
diff --git a/slpkg/progress_bar.py b/slpkg/progress_bar.py
index 959e2c21..5684a901 100644
--- a/slpkg/progress_bar.py
+++ b/slpkg/progress_bar.py
@@ -22,6 +22,9 @@ class ProgressBar(Configs):
         """ Creating progress bar. """
         spinner = PixelSpinner(f'{self.endc}{message} {filename} {self.bviolet}')
         # print('\033[F', end='', flush=True)
-        while True:
-            time.sleep(0.1)
-            spinner.next()
+        try:
+            while True:
+                time.sleep(0.1)
+                spinner.next()
+        except KeyboardInterrupt:
+            raise SystemExit(1)
diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py
index f5b204e2..fc9d757f 100644
--- a/slpkg/slackbuild.py
+++ b/slpkg/slackbuild.py
@@ -340,9 +340,12 @@ class Slackbuilds(Configs):
 
     def process(self, command: str) -> None:
         """ Processes execution. """
-        self.output = subprocess.call(command, shell=True, stderr=self.stderr, stdout=self.stdout)
-        if self.output != 0:
-            raise SystemExit(self.output)
+        try:
+            self.output = subprocess.call(command, shell=True, stderr=self.stderr, stdout=self.stdout)
+            if self.output != 0:
+                raise SystemExit(self.output)
+        except KeyboardInterrupt:
+            raise SystemExit(1)
 
     def print_error(self) -> None:
         """ Stop the process and print the error message. """