# File lib_doc/rucy/cgi.rb, line 69
    def cgi_open(path, args, env)
      if (@run_cmd) then
        cgi_cmd = CGIDocument.quote_sh(@run_cmd)
        cgi_cmd << ' '
        cgi_cmd << CGIDocument.quote_sh(path)
      else
        cgi_cmd = CGIDocument.quote_sh(path)
      end
      for cgi_arg in args
        cgi_cmd << ' '
        cgi_cmd << CGIDocument.quote_sh(cgi_arg)
      end
      begin
        cgi_io = PROC_RES_LOCK.synchronize{
          chenv(env) {
            chdir(File.dirname(path)) {
              IO.popen(cgi_cmd, 'r+')
            }
          }
        }
        cgi_io.binmode
        return yield(cgi_io)
      ensure
        cgi_io.close if cgi_io
      end
    end