Module: SimpleCov::ProcessForkHook
- Defined in:
- lib/simplecov/process.rb
Overview
Prepended onto Process’s singleton class so every fork — direct or via Kernel#fork / IO.popen — re-runs SimpleCov’s at_fork callback in the child.
Instance Method Summary collapse
Instance Method Details
#_fork ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/simplecov/process.rb', line 17 def _fork active = defined?(SimpleCov) && Coverage.running? # Assign the next serial in the PARENT, before the fork, so the child # inherits its own stable ordinal via copy-on-write. The default # at_fork uses it (instead of the child pid) to name the subprocess's # result, keeping that name identical across runs. See issue #1171. SimpleCov.next_subprocess_serial! if active pid = super SimpleCov.at_fork.call(::Process.pid) if pid.zero? && active pid end |