Yep, that's how I came across this problem initially.

Doing that (replace 'cat -' with my command) hung indefinetly.
Commenting out the stderr line fixed it.  I assume that it was waiting
for something to write to stderr before progressing.

Now, you are correct that the external process had terminated.  Why
that didn't close stderr and move on I do not know.  More importantly -
is there a way to do what Tom is suggesting - that is, have Ruby move
on the second the external process terminates - that will work on
Windows as well?

(As an aside, kudos to the developers of popen4 - it's really great.)


Tom Pollard wrote:
> On Oct 31, 2006, at 9:37 PM, Tom Pollard wrote:
> > If you're working in Unix you could try
> >
> >   status = POpen4::poen4('cat -') do |stdout, stderr, stdin|
>
> D'oh! (typo) That should have been
>
>    status = POpen4::popen4('cat -') do |stdout, stderr, stdin|
>      stdin.puts 'hello world'
>      stdin.close
>      puts "stdout: #{stdout.read.strip}"
>      puts "stderr: #{stderr.read.strip}"
>    end
> 
> 
> Tom