This class is highly experimental (even more so than the rest of Unicorn) and has never run anything other than cgit.
Intializes the app, example of usage in a config.ru
map "/cgit" do run Unicorn::App::ExecCgi.new("/path/to/cgit.cgi") end
# File lib/unicorn/app/exec_cgi.rb, line 52 def initialize(*args) self.args = args first = args[0] or raise ArgumentError, "need path to executable" first[0] == // or args[0] = ::File.expand_path(first) File.executable?(args[0]) or raise ArgumentError, "#{args[0]} is not executable" end
Calls the app
# File lib/unicorn/app/exec_cgi.rb, line 62 def call(env) out, err = Body.new, Unicorn::TmpIO.new inp = force_file_input(env) pid = fork { run_child(inp, out, err, env) } inp.close pid, status = Process.waitpid2(pid) write_errors(env, err, status) if err.stat.size > 0 err.close return parse_output!(out) if status.success? out.close [ 500, { 'Content-Length' => '0', 'Content-Type' => 'text/plain' }, [] ] end
Generated with the Darkfish Rdoc Generator 2.