Class: FCGIWrap

Inherits:
Object
  • Object
show all
Defined in:
lib/fcgiwrap.rb

Constant Summary collapse

VERSION =
"0.1.5"
@@cgi =
nil
@@shutdown =
false

Class Method Summary collapse

Class Method Details

.cgiObject



35
36
37
# File 'lib/fcgiwrap.rb', line 35

def cgi
  @@cgi
end

.each_requestObject Also known as: each, each_cgi, loop



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/fcgiwrap.rb', line 39

def each_request
  trap(:PIPE){ exit } 
  trap(:TERM){ @@cgi ? (@@shutdown = true) : exit } 
  trap(:INT){ @@cgi ? (@@shutdown = true) : exit } 
  FCGI.each_cgi { |@@cgi|
	ENV.clear
	ENV.update(@@cgi.env_table)
    begin
      yield
	rescue SystemExit
	  @@shutdown && raise
    ensure
      @@cgi = nil
      #Thread.list.each { |t|
      #  Thread.current == t and next
      #  t.kill
      #}
    end
	@@shutdown && exit
  }
end