Created
October 20, 2009 23:43
-
-
Save avdi/214722 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'tempfile' | |
def browse_string(body) | |
Tempfile.open('browse_string') do |f| | |
browser = ENV.fetch('BROWSER') { 'firefox' } | |
f.write(body) | |
f.close | |
puts "Starting browser #{browser} with response..." | |
unless system(browser, f.path) | |
warn "Error starting browser #{browser}" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment