diff --git a/Library/Homebrew/test.rb b/Library/Homebrew/test.rb index 7a333b3606..1ba9396a79 100644 --- a/Library/Homebrew/test.rb +++ b/Library/Homebrew/test.rb @@ -16,7 +16,7 @@ require "cli/parser" require "dev-cmd/test" require "json/add/exception" -TEST_TIMEOUT_SECONDS = 5 * 60 +DEFAULT_TEST_TIMEOUT_SECONDS = 5 * 60 begin ENV.delete("HOMEBREW_FORBID_PACKAGES_FROM_PATHS") @@ -49,7 +49,9 @@ begin if args.debug? # --debug is interactive run_test.call else - Timeout.timeout(TEST_TIMEOUT_SECONDS, &run_test) + # HOMEBREW_TEST_TIMEOUT_SECS is private API and subject to change. + timeout = ENV["HOMEBREW_TEST_TIMEOUT_SECS"]&.to_i || DEFAULT_TEST_TIMEOUT_SECONDS + Timeout.timeout(timeout, &run_test) end rescue Exception => e # rubocop:disable Lint/RescueException error_pipe.puts e.to_json