Nonblocking Windows Ruby popen? (was: Re: C Threads and Rub

From: “Francis C.” [email protected]

The impression I got from the windows select() documentation
was that it only works with winsock sockets.

Ruby’s Kernel#select is quite different from the native select. It’s deeply
intertwined with the green threads implementation. It basically knows how to
handle anything that can be wrapped in a Ruby IO object.

This has been percolating in the back of my mind for a month
or so now. :slight_smile:

I presume, even though Ruby may be able to handle anything that
can be wrapped in a Ruby IO object, there’s no implication that
this object can be handled in a green-thread-friendly way without
blocking all ruby threads?

I’m currently in search of a green-thread-friendly popen() in
Windows for Ruby. I just tried the win32-open3 package, but a
#gets on the pipe still blocks the whole process.

Does anyone know whether a nonblocking popen() is possible
in Windows Ruby? And if so, is there any existing implementation?

If not, what’s the best substitute? All I can think of offhand
is TCP connections on localhost/loopback.