diff --git a/tutordistro/distro/extra_commands/infrastructure/tutor_commands.py b/tutordistro/distro/extra_commands/infrastructure/tutor_commands.py index ff67f6c..a2b0188 100644 --- a/tutordistro/distro/extra_commands/infrastructure/tutor_commands.py +++ b/tutordistro/distro/extra_commands/infrastructure/tutor_commands.py @@ -45,10 +45,9 @@ def run_command(self, command: str): ) output, error = process.communicate() - if process.returncode == 0: - print(f'Commands ran properly!\n{output.decode()}') - else: + # If a command failed + if process.returncode != 0: raise CommandError(f'Error running command "{command}".\n{output.decode()}\n{error.decode()}') - + except subprocess.SubprocessError as error: raise CommandError(f'Error running command {command}: {error}') from error