Module: Process

Defined in:
lib/beanpicker/process.rb

Overview

Process Premium Version + Crack + Serial + two new methods

Class Method Summary collapse

Class Method Details

.die_with_parentObject

Create a thread to kill the current process if the parent process die



15
16
17
18
19
20
21
22
# File 'lib/beanpicker/process.rb', line 15

def self.die_with_parent
  Thread.new do
    while Process.running?(Process.ppid)
      sleep 1
    end
    Kernel.exit
  end
end

.running?(pid) ⇒ Boolean

Verify if a process is running

Returns:

  • (Boolean)


5
6
7
8
9
10
11
12
# File 'lib/beanpicker/process.rb', line 5

def self.running?(pid)
  begin
    Process.kill 0, pid
    return true
  rescue Errno::ESRCH, Errno::EPERM
    return false
  end
end