🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.ruby
Article #753

rails, htmldoc i cgi

#753
From: Bober
Date: Fri, 07 Dec 2007 09:38
38 lines
2457 bytes
Robie kolejne podejście go generowania pdfa w railsach przy użyciu
htmldoca.

Po głębokim rozpoznaniu problemu dochodzę do wniosku,
że coś jest nie tak z "rodzajami procesów".

Rozumiem, że jeśli odpalam proces rubiego z palca to jest wykonywany
jako zwykły proces systemowy, natomiast proces raisów jest wykonywany
jako cgi

Przepisuje przykład prosto z http://wiki.rubyonrails.org/rails/pages/HowtoGeneratePDFs

    add_variables_to_assigns
    htmldoc_env = "HTMLDOC_NOCGI=TRUE;export HTMLDOC_NOCGI"
    generator = IO.popen("#{htmldoc_env};htmldoc -t pdf --path
\".;http://#{@request.env["HTTP_HOST"]}\" --webpage -", "w+")
    generator.puts @template.render("article/pdf")
    generator.close_write

    send_data(generator.read, :filename =>
"#{@article.title}.pdf", :type => "application/pdf")


i przy "generator.puts dostaje błąd "Broken pipe"


teoretycznie autor wspomina o tym:
"(note: I banged my head against Broken Pipe errors until I discovered
that if you are using Apache, HTMLDOC runs as a CGI process and bombs
out unless you add the htmldoc_env declaration and inclusion into the
process call)"

jednak u mnie coś nie działa, bo jednak rzuca "broken pipe".
Czy można jakoś ładnie scalić proces odpalany jako cgi z zwyklym
procesem (htmldoc)?

pozdrawiam
Sebastian
Technical Details
Message-ID: <2309b716-ba05-4dd1-9d18-f532523be0af@p69g2000hsa.googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.glorb.com!postnews.google.com!p69g2000hsa.googlegroups.com!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.glorb.com!postnews.google.com!p69g2000hsa.googlegroups.com!not-for-mail
From: Bober <sebastian.bobrowski@gmail.com>
Newsgroups: pl.comp.lang.ruby
Subject: rails, htmldoc i cgi
Date: Fri, 7 Dec 2007 01:38:25 -0800 (PST)
Organization: http://groups.google.com
Lines: 39
Message-ID: <2309b716-ba05-4dd1-9d18-f532523be0af@p69g2000hsa.googlegroups.com>
NNTP-Posting-Host: 80.55.120.138
Mime-Version: 1.0
X-Trace: posting.google.com 1197020305 4507 127.0.0.1 (7 Dec 2007 09:38:25 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 7 Dec 2007 09:38:25 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: p69g2000hsa.googlegroups.com; posting-host=80.55.120.138;  posting-account=j0u1wgoAAAAXow7PxLkva59FtLVCAGI-
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.8.1.11)  Gecko/20071127 Firefox/2.0.0.11,gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.1 skarbowa.one.pl:8080 (squid/2.6.STABLE5)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit