Skip to content

Commit d61a939

Browse files
mblshaCommit Bot
authored and
Commit Bot
committed
mac_tool.py: Handle non-zero ibtool return code.
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 <[email protected]> Reviewed-by: Robert Sesek <[email protected]>
1 parent a478c1a commit d61a939

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

pylib/gyp/mac_tool.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,21 @@ def _CopyXIBFile(self, source, dest):
105105

106106
ibtool_section_re = re.compile(r'/\*.*\*/')
107107
ibtool_re = re.compile(r'.*note:.*is clipping its content')
108-
ibtoolout = subprocess.Popen(args, stdout=subprocess.PIPE)
108+
try:
109+
stdout = subprocess.check_output(args)
110+
except subprocess.CalledProcessError as e:
111+
print(e.output)
112+
raise
109113
current_section_header = None
110-
for line in ibtoolout.stdout:
114+
for line in stdout.splitlines():
111115
if ibtool_section_re.match(line):
112116
current_section_header = line
113117
elif not ibtool_re.match(line):
114118
if current_section_header:
115-
sys.stdout.write(current_section_header)
119+
print(current_section_header)
116120
current_section_header = None
117-
sys.stdout.write(line)
118-
return ibtoolout.returncode
121+
print(line)
122+
return 0
119123

120124
def _ConvertToBinary(self, dest):
121125
subprocess.check_call([

0 commit comments

Comments
 (0)