Skip to content
Snippets Groups Projects
Commit 9362a7c8 authored by Jack Nagel's avatar Jack Nagel
Browse files

Respect BROWSER environment variable

parent 1bce10ad
No related branches found
No related tags found
No related merge requests found
......@@ -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?
......
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
def exec_browser *args
browser = ENV['HOMEBREW_BROWSER'] || ENV['BROWSER'] || "open"
safe_exec(browser, *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 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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment