Sha256: 0fd37ffe42a5e6fb96be413a9cee241972d699b61b08576cef1c8dcbd4591913

Contents?: true

Size: 977 Bytes

Versions: 101

Compression:

Stored size: 977 Bytes

Contents

#!/usr/bin/env ruby1.9

def File::realpath(path)
  if File.symlink?(path)
    return self.realpath(File.readlink(path))
  end
  
  return path
end

require File.dirname(File.realpath(__FILE__)) + "/../autoload"

$_FCGI_COUNT = 0
require File.dirname(File.realpath(__FILE__)) + "/include"
$knj_eruby = KnjEruby
FCGI.each_cgi do |fcgi|
  $_FCGI_COUNT += 1
  $_CGI = fcgi
  $_FCGI = fcgi
  
  loadfp = File.dirname(__FILE__) + "/" + File.basename(__FILE__).slice(0..-6) + ".rhtml"
  
  begin
    KnjEruby.fcgi = fcgi
    KnjEruby.load(loadfp)
    
    if KnjEruby.connects["exit"]
      KnjEruby.connects["exit"].each do |block|
        block.call
      end
    end
    
    if $_FCGI_EXIT
      #Kill self! Need to start a new thread because the app as to finish. Give it 0.1 second to do that before killing it.
      Thread.new do
        sleep 0.5
        Process.kill(9, Process.pid)
      end
    end
  rescue Exception => e
    puts e.inspect
    puts e.backtrace
  end
end

Version data entries

101 entries across 101 versions & 1 rubygems

Version Path
knjrbfw-0.0.94 lib/knj/erb/erb_fcgi_1.9.rb
knjrbfw-0.0.93 lib/knj/erb/erb_fcgi_1.9.rb
knjrbfw-0.0.92 lib/knj/erb/erb_fcgi_1.9.rb
knjrbfw-0.0.91 lib/knj/erb/erb_fcgi_1.9.rb
knjrbfw-0.0.90 lib/knj/erb/erb_fcgi_1.9.rb
knjrbfw-0.0.89 lib/knj/erb/erb_fcgi_1.9.rb
knjrbfw-0.0.88 lib/knj/erb/erb_fcgi_1.9.rb
knjrbfw-0.0.87 lib/knj/erb/erb_fcgi_1.9.rb
knjrbfw-0.0.86 lib/knj/erb/erb_fcgi_1.9.rb
knjrbfw-0.0.85 lib/knj/erb/erb_fcgi_1.9.rb
knjrbfw-0.0.84 lib/knj/erb/erb_fcgi_1.9.rb
knjrbfw-0.0.83 lib/knj/erb/erb_fcgi_1.9.rb
knjrbfw-0.0.82 lib/knj/erb/erb_fcgi_1.9.rb
knjrbfw-0.0.81 lib/knj/erb/erb_fcgi_1.9.rb
knjrbfw-0.0.80 lib/knj/erb/erb_fcgi_1.9.rb
knjrbfw-0.0.79 lib/knj/erb/erb_fcgi_1.9.rb
knjrbfw-0.0.78 lib/knj/erb/erb_fcgi_1.9.rb
knjrbfw-0.0.77 lib/knj/erb/erb_fcgi_1.9.rb
knjrbfw-0.0.75 lib/knj/erb/erb_fcgi_1.9.rb
knjrbfw-0.0.74 lib/knj/erb/erb_fcgi_1.9.rb