Commit edda34d8 authored by mblsha.yandex.team's avatar mblsha.yandex.team Committed by Commit Bot

compile_ib_files.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

Review-Url: https://codereview.chromium.org/2947393002
Cr-Commit-Position: refs/heads/master@{#481948}
parent 12ef8855
...@@ -40,17 +40,21 @@ def main(): ...@@ -40,17 +40,21 @@ def main():
ibtool_section_re = re.compile(r'/\*.*\*/') ibtool_section_re = re.compile(r'/\*.*\*/')
ibtool_re = re.compile(r'.*note:.*is clipping its content') ibtool_re = re.compile(r'.*note:.*is clipping its content')
ibtoolout = subprocess.Popen(ibtool_args, stdout=subprocess.PIPE) try:
stdout = subprocess.check_output(ibtool_args)
except subprocess.CalledProcessError as e:
print(e.output)
raise
current_section_header = None current_section_header = None
for line in ibtoolout.stdout: for line in stdout.splitlines():
if ibtool_section_re.match(line): if ibtool_section_re.match(line):
current_section_header = line current_section_header = line
elif not ibtool_re.match(line): elif not ibtool_re.match(line):
if current_section_header: if current_section_header:
sys.stdout.write(current_section_header) print(current_section_header)
current_section_header = None current_section_header = None
sys.stdout.write(line) print(line)
return ibtoolout.returncode return 0
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment