diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index fe5ccbe192..0693634f5b 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -591,7 +591,7 @@ class Formula rescue ErrorDuringExecution raise BuildError.new(self, cmd, args, $?) ensure - f.close if f and not f.closed? + [rd, f].each { |io| io.close if io and not io.closed? } ENV.update(removed_ENV_variables) if removed_ENV_variables end