mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-09 01:18:29 -04:00
Tools: fix show_output bug in run_program methods
just because we're not showing output doesn't mean we shouldn't raise exceptions on failure!
This commit is contained in:
parent
a6feb97668
commit
2d38c8a896
@ -113,7 +113,7 @@ class build_binaries(object):
|
|||||||
raise Exception("BB-WAF: Missing compiler %s" % gcc_path)
|
raise Exception("BB-WAF: Missing compiler %s" % gcc_path)
|
||||||
self.run_program("BB-WAF", cmd_list, env=env)
|
self.run_program("BB-WAF", cmd_list, env=env)
|
||||||
|
|
||||||
def run_program(self, prefix, cmd_list, show_output=True, env=None):
|
def run_program(self, prefix, cmd_list, show_output=True, env=None, force_success=False):
|
||||||
if show_output:
|
if show_output:
|
||||||
self.progress("Running (%s)" % " ".join(cmd_list))
|
self.progress("Running (%s)" % " ".join(cmd_list))
|
||||||
p = subprocess.Popen(cmd_list, bufsize=1, stdin=None,
|
p = subprocess.Popen(cmd_list, bufsize=1, stdin=None,
|
||||||
@ -138,7 +138,7 @@ class build_binaries(object):
|
|||||||
if show_output:
|
if show_output:
|
||||||
print("%s: %s" % (prefix, x))
|
print("%s: %s" % (prefix, x))
|
||||||
(_, status) = returncode
|
(_, status) = returncode
|
||||||
if status != 0 and show_output:
|
if status != 0 and not force_success:
|
||||||
self.progress("Process failed (%s)" %
|
self.progress("Process failed (%s)" %
|
||||||
str(returncode))
|
str(returncode))
|
||||||
raise subprocess.CalledProcessError(
|
raise subprocess.CalledProcessError(
|
||||||
@ -211,7 +211,12 @@ is bob we will attempt to checkout bob-AVR'''
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
try:
|
try:
|
||||||
out = self.run_program('waf', ['./waf', 'configure', '--board=BOARDTEST'], False)
|
out = self.run_program(
|
||||||
|
'waf',
|
||||||
|
['./waf', 'configure', '--board=BOARDTEST'],
|
||||||
|
show_output=False,
|
||||||
|
force_success=True
|
||||||
|
)
|
||||||
lines = out.split('\n')
|
lines = out.split('\n')
|
||||||
needles = ["BOARDTEST' (choose from", "BOARDTEST': choices are"]
|
needles = ["BOARDTEST' (choose from", "BOARDTEST': choices are"]
|
||||||
for line in lines:
|
for line in lines:
|
||||||
|
@ -157,7 +157,7 @@ class SizeCompareBranches(object):
|
|||||||
if show_output:
|
if show_output:
|
||||||
print("%s: %s" % (prefix, x))
|
print("%s: %s" % (prefix, x))
|
||||||
(_, status) = returncode
|
(_, status) = returncode
|
||||||
if status != 0 and show_output:
|
if status != 0:
|
||||||
self.progress("Process failed (%s)" %
|
self.progress("Process failed (%s)" %
|
||||||
str(returncode))
|
str(returncode))
|
||||||
raise subprocess.CalledProcessError(
|
raise subprocess.CalledProcessError(
|
||||||
|
Loading…
Reference in New Issue
Block a user