From 660925d7a3ff669a6bc51e769b8aa33daf59c61f Mon Sep 17 00:00:00 2001 From: phil-bell Date: Tue, 8 Mar 2022 18:16:35 +0000 Subject: [PATCH] eating called process error --- legl_dev/command.py | 21 ++++++++++++--------- setup.py | 2 +- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/legl_dev/command.py b/legl_dev/command.py index 81e5651..c6bd4ed 100644 --- a/legl_dev/command.py +++ b/legl_dev/command.py @@ -1,7 +1,6 @@ #!/usr/bin/env python3 - -from subprocess import run -from threading import Thread +import typer +from subprocess import run, CalledProcessError from typing import Union @@ -15,12 +14,16 @@ def __init__( self.shell = shell def run(self) -> None: - run( - self.command if self.shell else self.command.split(), - universal_newlines=True, - shell=self.shell, - check=True, - ) + try: + run( + self.command if self.shell else self.command.split(), + universal_newlines=True, + shell=self.shell, + check=True, + ) + typer.secho(f"✅ Command successful!", fg=typer.colors.GREEN) + except CalledProcessError: + typer.secho(f"⚠️ Command exited without a none 0 exit!", fg=typer.colors.YELLOW) class Steps: diff --git a/setup.py b/setup.py index 14fed9d..7705eb8 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from setuptools import setup -version = "1.1.1" +version = "1.1.2" packages = ["legl_dev"]