Exit status of IO.popen process

How do you get the exit status of a process opened with IO.popen?

Process.waitpid seems to only return the pid of the process; the exit
status isn’t returned.

Sean O'Dell

Hi,

···

At Fri, 14 Jun 2002 10:47:13 +0900, Sean O’Dell wrote:

How do you get the exit status of a process opened with IO.popen?

Process.waitpid seems to only return the pid of the process; the exit
status isn’t returned.

Refer $?

IO.popen(“read x;exit $x”,“r+”){|f|f.puts(“10”)}
p $? #=> 2560 == 10<<8


Nobu Nakada