bin/hayabusa_fcgi.rb in hayabusa-0.0.5 vs bin/hayabusa_fcgi.rb in hayabusa-0.0.6

- old
+ new

@@ -1,37 +1,43 @@ #!/usr/bin/ruby #This scripts start an appserver, executes a CGI-request for every FCGI-request and terminates when FCGI terminates. #Good for programming appserver-supported projects that doesnt need threadding without running an appserver all the time. -debug = false - -$stderr.puts "[hayabusa] Starting up!" if debug error_log_file = "/tmp/hayabusa_fcgi.log" begin File.unlink(error_log_file) if File.exists?(error_log_file) rescue Errno::ENOENT #ignore. end begin - $stderr.puts "[hayabusa] Loading libs." if debug require "rubygems" - require "knjrbfw" require "fcgi" require "fileutils" - require "#{File.dirname(Knj::Os.realpath(__FILE__))}/../lib/hayabusa.rb" + #Try to load development-version to enable debugging without doing constant gem-installations. + path = "/home/kaspernj/Ruby/knjrbfw/lib/knjrbfw.rb" + if File.exists?(path) + require path + else + require "knjrbfw" + end + + #Load 'Hayabusa' and start the FCGI-loop to begin handeling requests. + require "#{File.dirname(Knj::Os.realpath(__FILE__))}/../lib/hayabusa.rb" fcgi = Hayabusa::Fcgi.new fcgi.fcgi_loop rescue Exception => e if !e.is_a?(Interrupt) + #Log error to the log-file if something happened. File.open(error_log_file, "w") do |fp| fp.puts e.inspect fp.puts e.backtrace fp.puts "" end end + #Just raise it normally as if a normal error occurred. raise e end \ No newline at end of file