Capturing output from external application results in Errno::EMFILE: Too many open files

Hi,

I’m after some help diagnosing a problem with capturing the output from
an external windows application.

I came across this problem after installing puppet which includes ruby
1.8.7 patchlevel 370. It is simple for me to reproduce using irb.

C:\Puppet\sys\ruby\bin>irb

irb(main):001:0> system(“hostname”)
Test-Sys
=> true

irb(main):002:0> my_host = IO.popen(“hostname”)
Errno::EMFILE: Too many open files - hostname
from (irb):2:in `popen’
from (irb):2

irb(main):003:0> my_host = hostname
Errno::EMFILE: Too many open files - hostname
from (irb):3:in ``’
from (irb):3

irb(main):004:0> my_host = %x(hostname)
Errno::EMFILE: Too many open files - hostname
from (irb):4:in ``’
from (irb):4

irb(main):005:0> my_host = %x(nonexistant_command)
Errno::ENOENT: No such file or directory - nonexistant_command
from (irb):5:in ``’
from (irb):5
from :heart::0

It doesn’t seem to matter what the command is but if I use a command
that it can’t find then I get a different error - indicating that it is
at least attempting to open a file.

I thought that it might be user permission related (somehow) but using
system would seem to eliminate that (exec also works).

Changing the case, including the path or changing the slashes ( \ or /
) doesn’t make a difference either.

I’m convinced that it is related to the windows distribution I am
receiving (it is actually windows xp embedded) since I have previous
generations of this product which work. I’m not actually in control of
creating the image but I can manipulate it.

I also tried with ruby 1.9.3 p286 and irb didn’t even start due to the
same error making it crash.

I suppose what I am asking is - does anybody know where can I start
looking to figure out what is going on?

Thanks in advance,

Larry.

Hopefully I can save someone else 2 weeks of hair pulling with the
answer:

The system was packaged without the null driver. Somehow this broke the
ruby/windows api calls.

Directions for fixing this were found at:

http://siebn.de/other/nulldevice/