Created
July 17, 2011 23:03
-
-
Save julik/1088203 to your computer and use it in GitHub Desktop.
Surviving rackup crashes when no output is available
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
#!/usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby | |
# | |
# This file was generated by Julik. | |
begin | |
require 'rubygems' | |
version = ">= 0" | |
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then | |
version = $1 | |
ARGV.shift | |
end | |
gem 'rack', version | |
load Gem.bin_path('rack', 'rackup', version) | |
rescue Exception => e | |
File.open("/tmp/rackup-crash.log", "w") do | f | | |
f.puts(ENV.inspect) | |
f.puts(e.class.to_s) | |
f.puts(e.message) | |
f.puts(e.backtrace.join("\n")) | |
end | |
# and raise further | |
raise e | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment