# Ruby IO on brand new xserve with Leopard Server

**URL:** <https://www.ruby-forum.com/t/ruby-io-on-brand-new-xserve-with-leopard-server/127965>\
**Category:** Rails\
**Created:** [February 3, 2008, 1:43pm UTC](https://www.ruby-forum.com/t/ruby-io-on-brand-new-xserve-with-leopard-server/127965 "2008-02-03T13:43:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_De\_Berdt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/53a042/32.png) [@Peter\_De\_Berdt](https://www.ruby-forum.com/u/Peter_De_Berdt)\
**Post date:** [February 3, 2008, 1:43pm UTC](https://www.ruby-forum.com/t/ruby-io-on-brand-new-xserve-with-leopard-server/127965/1 "2008-02-03T13:43:56Z")

</div>

Hi

I’m using princexml pdf generation in one of our apps and bump into  
this very weird problem. On our ubuntu box and local machines  
(MacBook Pro) pdfs are generated flawlessly. On the production xserve  
(running the rails app in production mode on a mongrel cluster), a  
2.8 GHz Quad-Core Intel Xeon, strange things start happening. The  
following sections give back nil values in production, but valid  
values in development (script/console, …) even on the xserve itself:

```
 @exe_path = `which prince`.chomp

 # Actually call the prince command, and pass the entire data

```

stream back.  
pdf = IO.popen(path, “w+”)  
pdf.puts(string)  
pdf.close\_write  
pdf.gets(nil)

When i call the commands manually from the console, they work, giving  
back a valid PDF file. In production mode, both are nil, bombing the  
application. It’s almost as if the ruby code is too fast to wait for  
the system call result. I’ve tried just about everything possible,  
even going as far as putting delays between each command, with no  
result whatsoever.

Has anyone experiences similar issues either on leopard server  
(default ruby bundled with the system) or an xserve?

Thanks in advance

Peter

---

<div class="post-metadata">

**Author:** ![Peter\_De\_Berdt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/53a042/32.png) [@Peter\_De\_Berdt](https://www.ruby-forum.com/u/Peter_De_Berdt)\
**Post date:** [February 3, 2008, 5:40pm UTC](https://www.ruby-forum.com/t/ruby-io-on-brand-new-xserve-with-leopard-server/127965/2 "2008-02-03T17:40:32Z")

</div>

On Feb 3, 2008, at 6:43 AM, Peter De Berdt wrote:

> ```
> @exe_path = `which prince`.chomp
> 
> # Actually call the prince command, and pass the entire data
> 
> ```
> 
> stream back.  
> pdf = IO.popen(path, “w+”)  
> pdf.puts(string)  
> pdf.close\_write  
> pdf.gets(nil)

I don’t know if this was a transcription problem or if this is the  
actual code you run, but I can’t see how it would work on any  
platform. You set @exe\_path but then don’t use it in IO.popen().

Another thing to look at is permissions. Does the process owner on the  
xserve have permissions to WRITE to the specified path? It might be  
failing silently on the xserve.

cr

---

<div class="post-metadata">

**Author:** ![Peter\_De\_Berdt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/53a042/32.png) [@Peter\_De\_Berdt](https://www.ruby-forum.com/u/Peter_De_Berdt)\
**Post date:** [February 3, 2008, 5:51pm UTC](https://www.ruby-forum.com/t/ruby-io-on-brand-new-xserve-with-leopard-server/127965/3 "2008-02-03T17:51:08Z")

</div>

On 03 Feb 2008, at 17:39, Chuck R. wrote:

> > ```
> > # Actually call the prince command, and pass the entire data
> > 
> > ```
> > 
> > stream back.  
> > pdf = IO.popen(path, “w+”)  
> > pdf.puts(string)  
> > pdf.close\_write  
> > pdf.gets(nil)
> 
> I don’t know if this was a transcription problem or if this is the  
> actual code you run, but I can’t see how it would work on any  
> platform. You set @exe\_path but then don’t use it in IO.popen().

Those are two sections of code. Here’s the complete code:  
[http://sublog.subimage.com/articles/2007/05/29/html-css-to-pdf-using-](http://sublog.subimage.com/articles/2007/05/29/html-css-to-pdf-using-)  
ruby-on-rails

The prince class can be seen here: [Parked at Loopia](http://pastie.caboo.se/146952)

> Another thing to look at is permissions. Does the process owner on the  
> xserve have permissions to WRITE to the specified path? It might be  
> failing silently on the xserve.

It doesn’t write anything, it just writes a command to the command  
line as far as I see. (Well, it does, to STDIN). Unless I’m missing  
something in the prince class.

Best regards

Peter De Berdt
