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.

[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?