bugfix: Executable
should record return code on CalledProcessError
Spack's `Executable` class isn't properly returning a called process's return code when it fails with a `CalledProcessError`. Record it before raising a `ProcessError` so that client code can query it later. Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
This commit is contained in:
parent
be57175413
commit
52ce977b93
@ -295,11 +295,11 @@ def streamify(arg, mode):
|
||||
raise ProcessError("%s: %s" % (self.exe[0], e.strerror), message)
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
self.returncode = e.returncode
|
||||
if fail_on_error:
|
||||
raise ProcessError(
|
||||
str(e),
|
||||
"\nExit status %d when invoking command: %s"
|
||||
% (proc.returncode, cmd_line_string),
|
||||
f"\nExit status {e.returncode} when invoking command: {cmd_line_string}",
|
||||
)
|
||||
except subprocess.TimeoutExpired as te:
|
||||
proc.kill()
|
||||
|
Loading…
Reference in New Issue
Block a user