From a5f7fc814e8e6452625fde42f958ee3804cb17e7 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 30 Aug 2022 12:21:02 +0000 Subject: [PATCH] cmd/deps: return failing exit code on circular dependencies. This makes more sense but will also be useful in `brew test-bot`. --- Library/Homebrew/cmd/deps.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index e684091929..85b42749d3 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -286,8 +286,14 @@ module Homebrew end display_s = "#{tree_lines} #{dep_display_name(dep, args: args)}" + + # Detect circular dependencies and consider them a failure if present. is_circular = dep_stack.include?(dep.name) - display_s = "#{display_s} (CIRCULAR DEPENDENCY)" if is_circular + if is_circular + display_s = "#{display_s} (CIRCULAR DEPENDENCY)" + Homebrew.failed = true + end + puts "#{prefix}#{display_s}" next if !recursive || is_circular