Sha256: 74ddf37e99d6d97e6ce7f986f1e80167bccf03f81fd7c67885aafee92e45a0a6

Contents?: true

Size: 597 Bytes

Versions: 6

Compression:

Stored size: 597 Bytes

Contents

module System

  def self.process_alive?(pid, verbose: true)
    begin
      Process.kill(0, pid)
      return true
    rescue Errno::EPERM                     # changed uid
      puts "No permission to query #{pid}!" if verbose
    rescue Errno::ESRCH
      puts "#{pid} is NOT running." if verbose      # or zombied
    rescue
      puts "Unable to determine status for #{pid} : #{$!}" if verbose
    end
    return false
  end

  def self.stop_process(pid)
    Process.kill('INT', pid)
    while process_alive?(pid, verbose: CLI_OPTS[:verbose])
      print "."
      sleep 0.3
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dblink-0.4.3 lib/dblink/system.rb
dblink-0.4.2 lib/dblink/system.rb
dblink-0.4.1 lib/dblink/system.rb
dblink-0.4 lib/dblink/system.rb
dblink-0.3 lib/dblink/system.rb
dblink-0.2 lib/dblink/system.rb