msvcdeps: fix 'WafError' AttributeError

This patch corrects an error in the exec_response_command exception
handler which always assumed that the execution's stdout would be bound
to the the WafError exception object.

However, this assumption is only true when the execution completes with
a non-zero status code. For other exceptions, the stdout attribute is
not bound.

Now, when stdout is not available, the WafError msg will be used
instead.
This commit is contained in:
Kevin Markussen 2018-05-14 09:21:30 -05:00 committed by Michael Vincent
parent 5e90de89d8
commit cce984f77b
1 changed files with 6 additions and 2 deletions

View File

@ -213,8 +213,12 @@ def exec_command(self, cmd, **kw):
raw_out = self.generator.bld.cmd_and_log(cmd + ['@' + tmp], **kw)
ret = 0
except Errors.WafError as e:
raw_out = e.stdout
ret = e.returncode
# Use e.msg if e.stdout is not set
raw_out = getattr(e, 'stdout', e.msg)
# Return non-zero error code even if we didn't
# get one from the exception object
ret = getattr(e, 'returncode', 1)
for line in raw_out.splitlines():
if line.startswith(INCLUDE_PATTERN):