aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/--env.rb
diff options
context:
space:
mode:
authorGreg Nisbet2016-08-10 23:19:09 -0700
committerGreg Nisbet2016-08-10 23:19:09 -0700
commit9a29a306cfd6b116a0cb696ce56bd7bc7679a8e3 (patch)
tree19eefeaea0baf5c39e2ea0795d2774ae852a8022 /Library/Homebrew/cmd/--env.rb
parent06fe347de97975dc01e726f87bf07a56a6fb713e (diff)
downloadbrew-9a29a306cfd6b116a0cb696ce56bd7bc7679a8e3.tar.bz2
resolve conflict in diagnostic.rb
Diffstat (limited to 'Library/Homebrew/cmd/--env.rb')
-rw-r--r--Library/Homebrew/cmd/--env.rb22
1 files changed, 18 insertions, 4 deletions
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