Process.waitpid(external pid)

Anybody know of a way in ruby to #waitpid on a non child process?

irb(main):001:0> Process.waitpid 32550
Errno::ECHILD: No child processes

[this is possible in doze with the win32-process gem, wondering about
linux now].
Thanks!
-r

On 2009-12-17, Roger P. [email protected] wrote:

Anybody know of a way in ruby to #waitpid on a non child process?

It seems unlikely in general – waitpid, in POSIX land, really is
specific
to your children.

Usually, the idiom is to send them signal 0 until it fails.

-s

Anybody know of a way in ruby to #waitpid on a non child process?

It seems unlikely in general – waitpid, in POSIX land, really is
specific
to your children.

Usually, the idiom is to send them signal 0 until it fails.

Excellent suggestion.
I have created a gem that does just that.

$ gem install wait_pid

provides you with this ruby code

require ‘wait_pid’
WaitPid.wait_pid 1234

and this binary command

$ wait_pid pid_number

Works in both windows and linux.

Cheers!
-r