Respect BROWSER environment variable
This commit is contained in:
parent
1bce10ad6c
commit
9362a7c897
@ -8,9 +8,9 @@ module Homebrew extend self
|
||||
|
||||
# Allow searching MacPorts or Fink.
|
||||
if ARGV.include? '--macports'
|
||||
exec "open", "http://www.macports.org/ports.php?by=name&substr=#{ARGV.next}"
|
||||
exec_browser "http://www.macports.org/ports.php?by=name&substr=#{ARGV.next}"
|
||||
elsif ARGV.include? '--fink'
|
||||
exec "open", "http://pdb.finkproject.org/pdb/browse.php?summary=#{ARGV.next}"
|
||||
exec_browser "http://pdb.finkproject.org/pdb/browse.php?summary=#{ARGV.next}"
|
||||
end
|
||||
|
||||
raise UsageError if ARGV.named.empty?
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
module Homebrew extend self
|
||||
def home
|
||||
if ARGV.named.empty?
|
||||
exec "open", HOMEBREW_WWW
|
||||
exec_browser HOMEBREW_WWW
|
||||
else
|
||||
exec "open", *ARGV.formulae.map{ |f| f.homepage }
|
||||
exec_browser *ARGV.formulae.map{ |f| f.homepage }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -4,9 +4,9 @@ require "blacklist"
|
||||
module Homebrew extend self
|
||||
def search
|
||||
if ARGV.include? '--macports'
|
||||
exec "open", "http://www.macports.org/ports.php?by=name&substr=#{ARGV.next}"
|
||||
exec_browser "http://www.macports.org/ports.php?by=name&substr=#{ARGV.next}"
|
||||
elsif ARGV.include? '--fink'
|
||||
exec "open", "http://pdb.finkproject.org/pdb/browse.php?summary=#{ARGV.next}"
|
||||
exec_browser "http://pdb.finkproject.org/pdb/browse.php?summary=#{ARGV.next}"
|
||||
else
|
||||
query = ARGV.first
|
||||
rx = case query
|
||||
|
||||
@ -171,11 +171,18 @@ end
|
||||
|
||||
def exec_editor *args
|
||||
return if args.to_s.empty?
|
||||
safe_exec(which_editor, *args)
|
||||
end
|
||||
|
||||
# Invoke bash to evaluate env vars in $EDITOR
|
||||
# This also gets us proper argument quoting.
|
||||
# See: https://github.com/mxcl/homebrew/issues/5123
|
||||
system "bash", "-i", "-c", which_editor + ' "$@"', "--", *args
|
||||
def exec_browser *args
|
||||
browser = ENV['HOMEBREW_BROWSER'] || ENV['BROWSER'] || "open"
|
||||
safe_exec(browser, *args)
|
||||
end
|
||||
|
||||
def safe_exec cmd, *args
|
||||
# This buys us proper argument quoting and evaluation
|
||||
# of environment variables in the cmd parameter.
|
||||
exec "/bin/sh", "-i", "-c", cmd + ' "$@"', "--", *args
|
||||
end
|
||||
|
||||
# GZips the given paths, and returns the gzipped paths
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user