From: Dave Thomas Date: 2000-11-29T04:53:03+09:00 Subject: [ruby-talk:6607] popen vs. open3 vs. Windows.... OK, I'll admit it. I'm spinning my wheels here, and need a clunk on the side of the head to get some traction. I'm trying to run a subprocess, reading back its standard output and standard error, along wth the process's exit status. This has to work under Linux, W95, and NT. * Attempt 1 IO.popen(cmd + " 2>&1", "w+") do |pipe| pipe.puts stuff pipe.close_write result = pipe.readlines end status = $? This works fine under Linux and W95. However, it fails under NT. The reason seems to be that the replacement for popen (mypopen in win32.c) notices the redirection on the command line, attempts to run the command with 'cmd /c' prefixed, and fails for some reason. (The NT version also fails to run any internal command such as 'dir' for the same reason). * Attempt 2 arr = open3(cmd) The problem here is that the latest open3 does a fork within a fork (why? it can't be a session thing as there's no setsid), and there's no way to get the exit status of the grandchild process. So: 1. Is the popen problem a known NT bug? 2. What can I do? Thanks Dave