From d345864d7e6f98488ed6fc454c0338bb20b751b2 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 28 Dec 2020 09:04:08 +0000 Subject: [PATCH] exceptions: fix ErrorDuringExecution status. This can sometimes be nil so handle that. Fixes #10158 --- Library/Homebrew/exceptions.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index 2ac40f09fc..4ff3212185 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -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}."