Module: Mutineer::OutputFilter::ForkHook

Defined in:
lib/mutineer/output_filter.rb

Overview

Runs after_fork! in the child. Kernel#fork, Kernel.fork, and Process.fork are separate, so all three are wrapped.

Instance Method Summary collapse

Instance Method Details

#fork ⇒ Integer?

Returns the child pid in the parent; nil in the child when no block is given.

Returns:

  • (Integer, nil) —

    the child pid in the parent; nil in the child when no block is given.



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/mutineer/output_filter.rb', line 29

def fork(*)
  if block_given?
    super do
      OutputFilter.after_fork!
      yield
    end
  else
    pid = super
    OutputFilter.after_fork! if pid.nil?
    pid
  end
end