Module: DEBUGGER__::ForkInterceptor
- Defined in:
- lib/debug/session.rb
Defined Under Namespace
Modules: DaemonInterceptor
Instance Method Summary
collapse
Instance Method Details
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
|
# File 'lib/debug/session.rb', line 2444
def _fork
return super unless defined?(SESSION) && SESSION.active?
parent_hook, child_hook = __fork_setup_for_debugger
super.tap do |pid|
if pid != 0
parent_hook.call pid
else
child_hook.call
end
end
end
|
#fork(&given_block) ⇒ Object
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
|
# File 'lib/debug/session.rb', line 2460
def fork(&given_block)
return super unless defined?(SESSION) && SESSION.active?
parent_hook, child_hook = __fork_setup_for_debugger
if given_block
new_block = proc {
child_hook.call
given_block.call
}
super(&new_block).tap{|pid| parent_hook.call(pid)}
else
super.tap do |pid|
if pid
parent_hook.call pid
else
child_hook.call
end
end
end
end
|