Land #2148, prefer xdg-open over sensible-browser
commit
5736f65d4e
|
@ -131,9 +131,11 @@ def self.open_browser(url='http://metasploit.com/')
|
|||
# Search through the PATH variable (if it exists) and chose a browser
|
||||
# We are making an assumption about the nature of "PATH" so tread lightly
|
||||
if defined? ENV['PATH']
|
||||
# "sensible-browser" opens the "default" browser in Ubuntu and others, so try that first
|
||||
# but also provide fallbacks
|
||||
['sensible-browser', 'firefox', 'opera', 'chromium-browser', 'konqueror'].each do |browser|
|
||||
# "xdg-open" is more general than "sensible-browser" and can be useful for lots of
|
||||
# file types -- text files, pcaps, or URLs. It's nearly always
|
||||
# going to use the application the user is expecting. If we're not
|
||||
# on something Debian-based, fall back to likely browsers.
|
||||
['xdg-open', 'sensible-browser', 'firefox', 'firefox-bin', 'opera', 'konqueror', 'chromium-browser'].each do |browser|
|
||||
ENV['PATH'].split(':').each do |path|
|
||||
# Does the browser exists?
|
||||
if File.exists?("#{path}/#{browser}")
|
||||
|
@ -143,9 +145,6 @@ def self.open_browser(url='http://metasploit.com/')
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
# If nothing else worked, default to firefox
|
||||
system("firefox #{url} &")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue