Use guard clause instead of ||.

This commit is contained in:
Markus Reiter 2018-07-19 13:36:27 +02:00
parent fec884d8da
commit ad7be58655
2 changed files with 4 additions and 2 deletions

View File

@ -69,7 +69,8 @@ class AbstractDownloadStrategy
def safe_system(*args)
if @shutup
quiet_system(*args) || raise(ErrorDuringExecution.new(args, status: $CHILD_STATUS))
return if quiet_system(*args)
raise(ErrorDuringExecution.new(args, status: $CHILD_STATUS))
else
super(*args)
end

View File

@ -302,7 +302,8 @@ end
# Kernel.system but with exceptions
def safe_system(cmd, *args, **options)
Homebrew.system(cmd, *args, **options) || raise(ErrorDuringExecution.new([cmd, *args], status: $CHILD_STATUS))
return if Homebrew.system(cmd, *args, **options)
raise(ErrorDuringExecution.new([cmd, *args], status: $CHILD_STATUS))
end
# prints no output