Module: Process
- Defined in:
- lib/process_exists/core_ext/process.rb
Overview
The Process module is a collection of methods used to manipulate processes.
Class Method Summary collapse
-
.exists?(pid) ⇒ Boolean
Checks if a PID exists.
Class Method Details
.exists?(pid) ⇒ Boolean
Checks if a PID exists
5 6 7 8 9 10 11 12 |
# File 'lib/process_exists/core_ext/process.rb', line 5 def self.exists?(pid) Process.kill(0, pid.to_i) true rescue Errno::ESRCH # No such process false rescue Errno::EPERM # Operation not permitted (the process exists but it belongs to other user/group) true end |