Skip to content

Commit

Permalink
mac_tool.py: Handle non-zero ibtool return code.
Browse files Browse the repository at this point in the history
Without check_output() the Popen() will always return None as returncode, this
prevents error handling during the build process.

With check_output() it will raise an exception in case of non-zero return code.

BUG=None

Change-Id: I911b7f65d9f58240893ed96d1170e5544f534278
Reviewed-on: https://chromium-review.googlesource.com/548400
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
  • Loading branch information
mblsha authored and Commit Bot committed Jun 27, 2017
1 parent a478c1a commit d61a939
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pylib/gyp/mac_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,21 @@ def _CopyXIBFile(self, source, dest):

ibtool_section_re = re.compile(r'/\*.*\*/')
ibtool_re = re.compile(r'.*note:.*is clipping its content')
ibtoolout = subprocess.Popen(args, stdout=subprocess.PIPE)
try:
stdout = subprocess.check_output(args)
except subprocess.CalledProcessError as e:
print(e.output)
raise
current_section_header = None
for line in ibtoolout.stdout:
for line in stdout.splitlines():
if ibtool_section_re.match(line):
current_section_header = line
elif not ibtool_re.match(line):
if current_section_header:
sys.stdout.write(current_section_header)
print(current_section_header)
current_section_header = None
sys.stdout.write(line)
return ibtoolout.returncode
print(line)
return 0

def _ConvertToBinary(self, dest):
subprocess.check_call([
Expand Down

0 comments on commit d61a939

Please sign in to comment.