From cb0fe44af3c3ba36be233bd563c6e149f2b91263 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Wed, 20 Feb 2019 09:33:00 -0800 Subject: [PATCH 1/2] tests: Set environment variable USER if not set These two tests fail if the enivornment variable USER is not set: ./test/utils/user_spec.rb:6 # User should eq nil ./test/utils/user_spec.rb:22 # User#gui? when the current user is in a console session gui? should equal true --- Library/Homebrew/dev-cmd/tests.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index bab63de71b..f58fc5d05a 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -49,6 +49,8 @@ module Homebrew ENV["HOMEBREW_TEST_GENERIC_OS"] = "1" if args.generic? ENV["HOMEBREW_TEST_ONLINE"] = "1" if args.online? + ENV["USER"] ||= Utils.popen_read("id", "-nu").chomp + # Avoid local configuration messing with tests e.g. git being configured # to use GPG to sign by default ENV["HOME"] = "#{HOMEBREW_LIBRARY_PATH}/test" From c74799fe8a4aec1a0ffdc8dacc64e9a27b0f9698 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 20 Feb 2019 11:33:00 -0800 Subject: [PATCH 2/2] tests: Use system_command rather than popen_read Co-Authored-By: sjackman --- Library/Homebrew/dev-cmd/tests.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index f58fc5d05a..e687b0f6bc 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -49,7 +49,7 @@ module Homebrew ENV["HOMEBREW_TEST_GENERIC_OS"] = "1" if args.generic? ENV["HOMEBREW_TEST_ONLINE"] = "1" if args.online? - ENV["USER"] ||= Utils.popen_read("id", "-nu").chomp + ENV["USER"] ||= system_command!("id", args: ["-nu"]).stdout.chomp # Avoid local configuration messing with tests e.g. git being configured # to use GPG to sign by default