[meld] maint: Make our subprocess helper abort on failure by default



commit e3bd67fedac1b358f3bf7d7887910e4fca7611fb
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Fri Aug 22 08:13:53 2014 +1000

    maint: Make our subprocess helper abort on failure by default

 maint.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/maint.py b/maint.py
index 9bf901f..291725e 100755
--- a/maint.py
+++ b/maint.py
@@ -220,7 +220,8 @@ def render_template(template):
     return(template.render(tokens))
 
 
-def call_with_output(cmd, stdin_text=None, echo_stdout=True):
+def call_with_output(
+        cmd, stdin_text=None, echo_stdout=True, abort_on_fail=True):
     PIPE = subprocess.PIPE
     with subprocess.Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) as proc:
         stdout, stderr = proc.communicate(stdin_text, timeout=10)
@@ -228,6 +229,9 @@ def call_with_output(cmd, stdin_text=None, echo_stdout=True):
         click.echo('\n' + stdout.decode('utf-8'))
     if stderr or proc.returncode:
         click.secho('\n' + stderr.decode('utf-8'), fg='red')
+    if abort_on_fail and proc.returncode:
+        click.abort()
+    return proc.returncode
 
 
 def check_release_branch():


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]