Exception: PosixPsutil::NoSuchProcess
- Inherits:
-
PsutilError
- Object
- StandardError
- PsutilError
- PosixPsutil::NoSuchProcess
- Defined in:
- lib/posixpsutil/psutil_error.rb
Overview
Raise it if the process behind doesn’t exist when you try to call a method of a Process instance.
Instance Method Summary collapse
-
#initialize(opt = {}) ⇒ NoSuchProcess
constructor
should be used at least like NoSuchProcess.new(pid: xxx).
Methods inherited from PsutilError
Constructor Details
#initialize(opt = {}) ⇒ NoSuchProcess
should be used at least like NoSuchProcess.new(pid: xxx)
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/posixpsutil/psutil_error.rb', line 13 def initialize(opt={}) raise ArgumentError if opt[:pid].nil? @pid = opt[:pid] # pid must given @name = opt[:name] || nil if opt[:msg].nil? if @name details = "(pid=#{@pid}, name=#{@name.to_s})" else details = "(pid=#{@pid})" end opt[:msg] = "process no longer exists " + details end @message = opt[:msg] end |