Regarding _popen() in windows 2000

Hi All,

I have a console application. In windows 2000, _popen() is returning
invalid handle. I checked the same app with 2003 Server, its working
fine.

Please suggest …

Thanks !

On Sep 14, 12:05 pm, [email protected] wrote:

Hi All,

I have a console application. In windows 2000, _popen() is returning
invalid handle. I checked the same app with 2003 Server, its working
fine.

Are you talking about IO.popen? I didn’t think Ruby used _popen()
behind the scenes, but it’s been a while since I looked. The _popen()
function is basically broken on Windows. From MSDN:

“If used in a Windows program, the _popen function returns an invalid
file pointer that will cause the program to hang indefinitely. _popen
works properly in a Console application. To create a Windows
application that redirects input and output, see “Creating a Child
Process with Redirected Input and Output” in the Platform SDK.”

Regards,

Dan

On Sep 15, 12:38 am, Daniel B. [email protected] wrote:

function is basically broken on Windows. From MSDN:

“If used in a Windows program, the _popen function returns an invalid
file pointer that will cause the program to hang indefinitely. _popen
works properly in a Console application. To create a Windows
application that redirects input and output, see “Creating a Child
Process with Redirected Input and Output” in the Platform SDK.”

Regards,

Dan

Thanks a lot! The problem is resolved by setting /MD flag.