From 4db0b9963c401296f7099118ac0a36fce8cf3114 Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Sun, 6 Mar 2022 19:06:28 +0000 Subject: [PATCH] test/spec_helper: prevent stdin trashing --- Library/Homebrew/test/spec_helper.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index bb5a310340..fa0f2ad911 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -214,12 +214,14 @@ RSpec.configure do |config| @__stdout = $stdout.clone @__stderr = $stderr.clone + @__stdin = $stdin.clone begin if (example.metadata.keys & [:focus, :byebug]).empty? && !ENV.key?("HOMEBREW_VERBOSE_TESTS") $stdout.reopen(File::NULL) $stderr.reopen(File::NULL) end + $stdin.reopen(File::NULL) begin timeout = example.metadata.fetch(:timeout, 60) @@ -236,8 +238,10 @@ RSpec.configure do |config| $stdout.reopen(@__stdout) $stderr.reopen(@__stderr) + $stdin.reopen(@__stdin) @__stdout.close @__stderr.close + @__stdin.close Formulary.clear_cache Tap.clear_cache