Process.waitpid(external pid)

R

Roger Pack

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
 
S

Seebs

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
 
R

Roger Pack

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

http://github.com/rdp/wait_pid
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top