module Obfusk::Util::Process
Constants
- GET_AGE
Public Class Methods
age(pid)
click to toggle source
get process age information from ps
# File lib/obfusk/util/process.rb, line 20 def self.age(pid) ispid! pid; %x[#{GET_AGE[pid]}].gsub(/\s/, '') end
alive?(pid)
click to toggle source
process alive? @return [Boolean] false if not alive @return [Boolean] true if alive and mine @return [Symbol] :not_mine if alive and not mine
# File lib/obfusk/util/process.rb, line 28 def self.alive?(pid) ::Process.kill 0, pid; true rescue Errno::EPERM; :not_mine rescue Errno::ESRCH; false end
ispid!(pid)
click to toggle source
@raise ArgumentError if pid is not an integer
# File lib/obfusk/util/process.rb, line 35 def self.ispid!(pid) pid.is_a? Integer or raise ArgumentError, 'invalid PID' end