mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 05:24:53 +01:00
Fix return value of run_external_command (#5657)
This commit is contained in:
parent
f70d651a39
commit
4edf3efdf3
1 changed files with 5 additions and 4 deletions
|
@ -222,7 +222,7 @@ def run_external_command(
|
|||
try:
|
||||
sys.argv = list(cmd)
|
||||
sys.exit = mock_exit
|
||||
return func() or 0
|
||||
retval = func() or 0
|
||||
except KeyboardInterrupt: # pylint: disable=try-except-raise
|
||||
raise
|
||||
except SystemExit as err:
|
||||
|
@ -238,9 +238,10 @@ def run_external_command(
|
|||
sys.stdout = orig_stdout
|
||||
sys.stderr = orig_stderr
|
||||
|
||||
if capture_stdout:
|
||||
# pylint: disable=lost-exception
|
||||
return cap_stdout.getvalue()
|
||||
if capture_stdout:
|
||||
return cap_stdout.getvalue()
|
||||
|
||||
return retval
|
||||
|
||||
|
||||
def run_external_process(*cmd, **kwargs):
|
||||
|
|
Loading…
Reference in a new issue