Rails, htmldoc and cgi

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/HowtoGeneratePDFs

I would like use htmldoc

but I have a problem with broken pipe.

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")

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?

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 B.

Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs