From 9a29a306cfd6b116a0cb696ce56bd7bc7679a8e3 Mon Sep 17 00:00:00 2001 From: Greg Nisbet Date: Wed, 10 Aug 2016 23:19:09 -0700 Subject: resolve conflict in diagnostic.rb --- Library/Homebrew/cmd/--env.rb | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'Library/Homebrew/cmd') diff --git a/Library/Homebrew/cmd/--env.rb b/Library/Homebrew/cmd/--env.rb index 281175c93..292bcf866 100644 --- a/Library/Homebrew/cmd/--env.rb +++ b/Library/Homebrew/cmd/--env.rb @@ -3,6 +3,7 @@ require "extend/ENV" require "build_environment" +require "utils/shell" module Homebrew def __env @@ -11,12 +12,25 @@ module Homebrew ENV.setup_build_environment ENV.universal_binary if ARGV.build_universal? - if $stdout.tty? + shell_value = ARGV.value("shell") + has_plain = ARGV.include?("--plain") + + if has_plain + shell = nil + elsif shell_value.nil? + # legacy behavior + shell = :bash unless $stdout.tty? + elsif shell_value == "auto" + shell = Utils::Shell.parent_shell || Utils::Shell.preferred_shell + elsif shell_value + shell = Utils::Shell.path_to_shell(shell_value) + end + + env_keys = build_env_keys(ENV) + if shell.nil? dump_build_env ENV else - build_env_keys(ENV).each do |key| - puts "export #{key}=\"#{ENV[key]}\"" - end + env_keys.each { |key| puts Utils::Shell.export_value(shell, key, ENV[key]) } end end end -- cgit v1.2.3