Skip to content

Commit bd35044

Browse files
authored
Improve error output when a command fails (#176)
1 parent 406fcce commit bd35044

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

cherry_picker/cherry_picker.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,11 @@ def run_cmd(self, cmd, required_real_result=False):
238238
if not required_real_result and self.dry_run:
239239
print(f" dry-run: {' '.join(cmd)}")
240240
return
241-
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
241+
try:
242+
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
243+
except subprocess.CalledProcessError as exc:
244+
click.echo(exc.output.decode("utf-8"))
245+
raise
242246
return output.decode("utf-8")
243247

244248
def checkout_branch(self, branch_name, *, create_branch=False):

0 commit comments

Comments
 (0)