Sha256: 0c46061a58077bd3b1209158cd8a99c4f02d8c5fcce5dad8108958fe10a3ac83

Contents?: true

Size: 777 Bytes

Versions: 16

Compression:

Stored size: 777 Bytes

Contents

# frozen_string_literal: true

# Overrides for Process module
module ::Process
  class << self
    # @!visibility private
    alias_method :orig_detach, :detach

    # Detaches the given pid and returns a fiber waiting on it.
    #
    # @param pid [Integer] child pid
    # @return [Fiber] new fiber waiting on pid
    def detach(pid)
      fiber = spin { Polyphony.backend_waitpid(pid) }
      fiber.define_singleton_method(:pid) { pid }
      fiber
    end

    # @!visibility private
    alias_method :orig_daemon, :daemon

    # Starts a daemon with the given arguments.
    #
    # @param args [any] arguments to pass to daemon
    # @return [Integer] daemon pid
    def daemon(*args)
      orig_daemon(*args)
      Polyphony.original_pid = Process.pid
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
polyphony-1.5 lib/polyphony/extensions/process.rb
polyphony-1.4 lib/polyphony/extensions/process.rb
polyphony-1.3 lib/polyphony/extensions/process.rb
polyphony-1.2.1 lib/polyphony/extensions/process.rb
polyphony-1.2 lib/polyphony/extensions/process.rb
polyphony-1.1.1 lib/polyphony/extensions/process.rb
polyphony-1.1 lib/polyphony/extensions/process.rb
polyphony-1.0.2 lib/polyphony/extensions/process.rb
polyphony-1.0.1 lib/polyphony/extensions/process.rb
polyphony-1.0 lib/polyphony/extensions/process.rb
polyphony-0.99.6 lib/polyphony/extensions/process.rb
polyphony-0.99.5 lib/polyphony/extensions/process.rb
polyphony-0.99.4 lib/polyphony/extensions/process.rb
polyphony-0.99.3 lib/polyphony/extensions/process.rb
polyphony-0.99.2 lib/polyphony/extensions/process.rb
polyphony-0.99.1 lib/polyphony/extensions/process.rb