Fix return value of run_external_command (#5657)

This commit is contained in:
Jesse Hills 2023-11-02 17:06:09 +13:00 committed by GitHub
parent f70d651a39
commit 4edf3efdf3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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):