From: ara.t.howard@... Date: 2006-03-21T01:59:04+09:00 Subject: Re: IO#popen and exit status On Tue, 21 Mar 2006, Claudio Jeker wrote: > I'm a bit stuck with this porblem: > I need to write data to a process and then wait for the exit code of it to > see if it was successful or not. > > Now I can IO.popen the process but there is no pclose instance method to > get the exitcode back. Additionally my workaround via Process.waitpid2 does > not work either. I think io.close does already all the cleanup. > > e.g. > > io = IO.popen(cmd, "w") > io.write(msg) > io.close > pid, status = Process.waitpid2(0) > > Raises a "Errno::ECHILD: No child processes" exception. > > How do other handle this situation? Do I need to take the hard road via > pipe, fork, exec or did I miss something obvious? gem install open4 -a -- share your knowledge. it's a way to achieve immortality. - h.h. the 14th dali lama