[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

rails, htmldoc and cgi

Bober

12/7/2007 9:56:00 AM

Hello,
I have some problems with external proces, which is started by rails.

I have found something about generate pdf in rails:

http://wiki.rubyonrails.org/rails/pages/HowtoGe...

I would like use htmldoc

but I have a problem with broken pipe.

[code]
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 => "test.pdf", :type =>
"application/pdf")
[/code]

When I run it directly from shell everything is ok,
but when I ruby it from method in rails controller,
I see "Broken pipe".

I think, that there is a problem, because rails are cgi process and
htmldoc not. How to improve this?
Can I run htmldoc as cgi process?
1 Answer

Giles Bowkett

12/8/2007 1:07:00 AM

0

> I have some problems with external proces, which is started by rails.

Hi - this isn't the Rails list - but fwiw you want to avoid starting
external processes in Rails. It has pitfalls. Ask on the Rails list
about BackgrounDRb.

--
Giles Bowkett

Podcast: http://hollywoodgrit.bl...
Blog: http://gilesbowkett.bl...
Portfolio: http://www.gilesg...
Tumblelog: http://giles....