class Process::Group::Fork

Runs a given block using a forked process.

Public Class Methods

new(block, **options) click to toggle source
Calls superclass method Process::Group::Command::new
# File lib/process/group.rb, line 78
def initialize(block, **options)
        @block = block
        
        super(**options)
end

Public Instance Methods

call(**options) click to toggle source
# File lib/process/group.rb, line 84
def call(**options)
        options = @options.merge(options)
        
        @pid = Process.fork(&@block)
        
        if options[:pgroup] == true
                # Establishes the child process as a process group leader:
                Process.setpgid(@pid, 0)
        elsif pgroup = options[:pgroup]
                # Set this process as part of the existing process group:
                Process.setpgid(@pid, pgroup)
        end
        
        return @pid
end
resume(*arguments) click to toggle source
# File lib/process/group.rb, line 100
def resume(*arguments)
        @fiber.resume(*arguments)
end