Module: SimpleCov::ProcessForkHook
- Defined in:
- lib/simplecov/process.rb
Overview
Prepended onto Process's singleton class so every fork re-runs SimpleCov's
at_fork callback in the child. Process._fork is the official extension
point: Kernel#fork, Process.fork, and IO.popen("-") all funnel
through it, and prepending composes with other libraries doing the same.
Instance Method Summary collapse
-
#_fork ⇒ Object
The next serial is assigned in the parent, before the fork, so the child inherits its own stable ordinal via copy-on-write, and the child is marked here independent of whatever custom at_fork block the user installed so
final_result_process?can keep forked workers from each producing the final report (#1171, #1227).
Instance Method Details
#_fork ⇒ Object
The next serial is assigned in the parent, before the fork, so the child
inherits its own stable ordinal via copy-on-write, and the child is marked
here independent of whatever custom at_fork block the user installed so
final_result_process? can keep forked workers from each producing the
final report (#1171, #1227).
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/simplecov/process.rb', line 27 def _fork active = defined?(SimpleCov) && Coverage.running? SimpleCov.next_subprocess_serial! if active pid = super if pid.zero? && active SimpleCov.mark_forked_subprocess! SimpleCov.reset_inherited_at_exit_state! SimpleCov.at_fork.call(::Process.pid) end pid end |