Class: Mutant::Isolation::Fork Private

Inherits:
Mutant::Isolation show all
Includes:
Adamantium::Flat
Defined in:
lib/mutant/isolation/fork.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Isolation via the fork(2) systemcall.

Defined Under Namespace

Classes: Child, ChildError, ForkError, Parent, Pipe

Constant Summary collapse

READ_SIZE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

4096
ATTRIBUTES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%i[block log_pipe result_pipe world].freeze

Instance Method Summary collapse

Instance Method Details

#call(&block) ⇒ Result

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Call block in isolation

ignore :reek:NestedIterators

rubocop:disable Metrics/MethodLength

Returns:

  • (Result)

    execution result



165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/mutant/isolation/fork.rb', line 165

def call(&block)
  io = world.io
  Pipe.with(io) do |result|
    Pipe.with(io) do |log|
      Parent.call(
        block:       block,
        log_pipe:    log,
        result_pipe: result,
        world:       world
      )
    end
  end
end