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.
|
# Allow searching MacPorts or Fink.
|
||||||
if ARGV.include? '--macports'
|
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'
|
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
|
end
|
||||||
|
|
||||||
raise UsageError if ARGV.named.empty?
|
raise UsageError if ARGV.named.empty?
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
module Homebrew extend self
|
module Homebrew extend self
|
||||||
def home
|
def home
|
||||||
if ARGV.named.empty?
|
if ARGV.named.empty?
|
||||||
exec "open", HOMEBREW_WWW
|
exec_browser HOMEBREW_WWW
|
||||||
else
|
else
|
||||||
exec "open", *ARGV.formulae.map{ |f| f.homepage }
|
exec_browser *ARGV.formulae.map{ |f| f.homepage }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,9 +4,9 @@ require "blacklist"
|
|||||||
module Homebrew extend self
|
module Homebrew extend self
|
||||||
def search
|
def search
|
||||||
if ARGV.include? '--macports'
|
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'
|
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
|
else
|
||||||
query = ARGV.first
|
query = ARGV.first
|
||||||
rx = case query
|
rx = case query
|
||||||
|
|||||||
@ -171,11 +171,18 @@ end
|
|||||||
|
|
||||||
def exec_editor *args
|
def exec_editor *args
|
||||||
return if args.to_s.empty?
|
return if args.to_s.empty?
|
||||||
|
safe_exec(which_editor, *args)
|
||||||
|
end
|
||||||
|
|
||||||
# Invoke bash to evaluate env vars in $EDITOR
|
def exec_browser *args
|
||||||
# This also gets us proper argument quoting.
|
browser = ENV['HOMEBREW_BROWSER'] || ENV['BROWSER'] || "open"
|
||||||
# See: https://github.com/mxcl/homebrew/issues/5123
|
safe_exec(browser, *args)
|
||||||
system "bash", "-i", "-c", which_editor + ' "$@"', "--", *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
|
end
|
||||||
|
|
||||||
# GZips the given paths, and returns the gzipped paths
|
# GZips the given paths, and returns the gzipped paths
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user