Method: WaitPid.wait_nonchild_pid

Defined in:
lib/wait_pid.rb

.wait_nonchild_pid(pid, test = false) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/wait_pid.rb', line 4

def self.wait_nonchild_pid(pid, test = false)
  # initial test
  count = 0
  begin
    loop { Process.kill( 0, pid); count += 1; sleep 0.01}
  rescue Errno::ESRCH
    if count == 0
      if test
        return "non existing"
      else
        puts "warning: pid not found #{pid}" if $VERBOSE
      end
    else
      # normal
    end
  end

end