I want to create s subprocess in Ruby for running and interacting with other programs, and I need to use Process.spawn
because Open3.popen3
does not work in Windows. Open3.popen3
gives you a nice wait-thread object that allows you to check if the process has finished via wait_thr.status
, and once it was finished it allows you to get it's exit code via wait_thr.value.exitstatus
.
Process.spawn
only gives you the pid
, so I need a way to get that data from the process id. I've looked at the Process
and Kernel
modules and found nothing. Process::Status
has everything I need, but I can't find any information on how to create one from pid.
How can I tell when the process has finished and what was it's exit status?