From f3a68b616c75b306d7b6b7be31f731ce2ab843a4 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 15 Jan 2025 23:34:23 +0000 Subject: [PATCH] Early return in `Tty#color?` for nil `@stream` --- Library/Homebrew/utils/tty.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/utils/tty.rb b/Library/Homebrew/utils/tty.rb index e033f85111..62e7cd232f 100644 --- a/Library/Homebrew/utils/tty.rb +++ b/Library/Homebrew/utils/tty.rb @@ -161,8 +161,9 @@ module Tty return false if Homebrew::EnvConfig.no_color? return true if Homebrew::EnvConfig.color? + return false if @stream.blank? - !!@stream&.tty? + @stream.tty? end end end