Module: Specjour::Fork
Class Method Summary collapse
-
.fork ⇒ Object
fork, but don’t run the parent’s exit handlers The one exit handler we lose however, is the printing out of exceptions, so reincorporate that.
- .fork_quietly ⇒ Object
Class Method Details
.fork ⇒ Object
fork, but don’t run the parent’s exit handlers The one exit handler we lose however, is the printing out of exceptions, so reincorporate that.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/specjour/fork.rb', line 8 def fork Kernel.fork do at_exit { exit! } begin yield rescue StandardError => e $stderr.puts "#{e.class} #{e.}", e.backtrace end end end |
.fork_quietly ⇒ Object
19 20 21 22 23 24 |
# File 'lib/specjour/fork.rb', line 19 def fork_quietly fork do $stdout = StringIO.new yield end end |