Skip to content

Commit

Permalink
PARQUET-331: Surface subprocess stderr in merge script
Browse files Browse the repository at this point in the history
This makes it a little easier to understand why the merge script failed

Author: Alex Levenson <alexlevenson@twitter.com>

Closes #240 from isnotinvain/alexlevenson/merge-script-error-handling and squashes the following commits:

7c38c01 [Alex Levenson] Surface subprocess stderr in merge script
  • Loading branch information
isnotinvain committed Jul 14, 2015
1 parent fcd5682 commit be9f3cb
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions dev/merge_parquet_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,19 @@ def fail(msg):


def run_cmd(cmd):
if isinstance(cmd, list):
return subprocess.check_output(cmd)
else:
return subprocess.check_output(cmd.split(" "))

try:
if isinstance(cmd, list):
return subprocess.check_output(cmd, stderr=subprocess.STDOUT)
else:
return subprocess.check_output(cmd.split(" "), stderr = subprocess.STDOUT)
except subprocess.CalledProcessError as e:
# this avoids hiding the stdout / stderr of failed processes
print 'Command failed: %s' % cmd
print 'With output:'
print '--------------'
print e.output
print '--------------'
raise e

def continue_maybe(prompt):
result = raw_input("\n%s (y/n): " % prompt)
Expand Down

0 comments on commit be9f3cb

Please sign in to comment.