Thanks Ben for your response:

Your cat example fixed the problem with wkhtmltopdf but .pipe() doesn't 
close properly so the response never finishes.

```
wkhtmltopdf.stdout.pipe(res)
```

This starts a download in the browser but never completes (however if I 
kill the server it completes :)

I have a ton of strace -f output, is there anything I should look for, I 
could paste it up somewhere if that helps.

Marc

On Tuesday, July 10, 2012 3:18:15 PM UTC-5, Ben Noordhuis wrote:
>
> On Tue, Jul 10, 2012 at 3:58 PM, wavded <[email protected]> wrote: 
> > The following code worked fine in 0.6.19, but fails in 0.8.x: 
> > 
> > 
> https://github.com/applieddataconsultants/pdfsnag/blob/master/pdfsnag.js#L108-110
>  
> > 
> > I know spawn changed a bit in how it handles stdio in 0.8.x.  The issue 
> is 
> > that wkhtmltopdf is either failing because of write permissions issue 
> (its 
> > trying to write out to stdout) or a LD_LIBRARY_PATH issue now where it 
> > didn't before and I can't figure out how to setup spawn to behave like 
> it 
> > did in 0.6.19. 
> > 
> > Any ideas?  I can get more information if you need. 
>
> What do you see when you trace it with `strace -f`? 
>
> One change that seems to trip up some applications is that the stdio 
> file descriptors of the child process are now (anonymous) UNIX domain 
> sockets again. An easy workaround is to change your call to spawn() 
> from: 
>
>   spawn('wkhtmltopdf'); 
>
> To: 
>
>   spawn('/bin/sh', ['-c', 'cat | wkhtmltopdf | cat']); 
>
> That ensures that wkhtmltopdf sees regular pipes as stdin and stdout. 
>
> (Be careful when appending parameters, though. Sanitize your input.) 
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to