exceptions: fix ErrorDuringExecution status.

This can sometimes be nil so handle that.

Fixes #10158
This commit is contained in:
Mike McQuaid 2020-12-28 09:04:08 +00:00
parent bcbf5857da
commit d345864d7e
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

@ -582,7 +582,7 @@ class ErrorDuringExecution < RuntimeError
when Integer
status
else
status.exitstatus
status&.exitstatus
end
redacted_cmd = redact_secrets(cmd.shelljoin.gsub('\=', "="), secrets)
@ -592,7 +592,7 @@ class ErrorDuringExecution < RuntimeError
elsif (uncaught_signal = status.termsig)
"was terminated by uncaught signal #{Signal.signame(uncaught_signal)}"
else
raise ArgumentError, "Status does neither have `exitstatus` nor `termsig`."
raise ArgumentError, "Status neither has `exitstatus` nor `termsig`."
end
s = +"Failure while executing; `#{redacted_cmd}` #{reason}."