Module: Process

Extended by:
Polyphony::TrapInterceptor
Defined in:
lib/polyphony/extensions/process.rb,
lib/polyphony/extensions/kernel.rb

Overview

Overrides for Process module

Defined Under Namespace

Modules: StatusExtensions Classes: Status

Class Method Summary collapse

Methods included from Polyphony::TrapInterceptor

trap

Class Method Details

.daemon(*args) ⇒ Integer

Starts a daemon with the given arguments.

Parameters:

  • args (any)

    arguments to pass to daemon

Returns:

  • (Integer)

    daemon pid



101
102
103
104
# File 'lib/polyphony/extensions/process.rb', line 101

def daemon(*args)
  orig_daemon(*args)
  Polyphony.original_pid = Process.pid
end

.detach(pid) ⇒ Fiber

Detaches the given pid and returns a fiber waiting on it.

Parameters:

  • pid (Integer)

    child pid

Returns:

  • (Fiber)

    new fiber waiting on pid



88
89
90
91
92
# File 'lib/polyphony/extensions/process.rb', line 88

def detach(pid)
  fiber = spin { ::Process::Status.from_status_array(Polyphony.backend_waitpid(pid)) }
  fiber.define_singleton_method(:pid) { pid }
  fiber
end