Fixed for stderr exit code

This commit is contained in:
Dimitris Zlatanidis 2023-04-02 09:01:21 +03:00
parent d53d45aab8
commit 17a4c03048

View file

@ -157,10 +157,13 @@ class Utilities:
def process(command: str, stderr=None, stdout=None) -> None:
""" Handle the processes. """
try:
subprocess.call(command, shell=True, stderr=stderr, stdout=stdout)
output = subprocess.call(command, shell=True, stderr=stderr, stdout=stdout)
except (KeyboardInterrupt, subprocess.CalledProcessError) as err:
raise SystemExit(err)
if output != 0:
raise SystemExit(output)
def raise_error_message(self, message: str) -> None:
""" A general method to raise an error message and exit. """
raise SystemExit(f"\n{self.configs.prog_name}: {self.bred}Error{self.endc}: {message}.\n")