I'm using popen to launch a program so that I can get the stdin of that
process and send a Control-C to it after a specified amount of time, like:
someTime = 100
command = "someprog -someargs"
begin
timeout(someTime) do
cmdstdin = IO.popen("#{command}","w")
Process.wait
end
rescue TimeoutError
cmdstdin.putc "^C"
end
This works fine on WindowsNT and Win2K but not on Win95|98 (for the
moment, that's OK, I've got another way to do it on those platforms
involving calls to Win32API functions.). What I still need from this is a
way to determine the exitcode of the program that was run in popen. Is
there any way of doing that?
With system you get the exitcode, but not the stdin for the child program,
with popen you get the stdin, but not the exitcode...
Phil