# File lib/open4.rb, line 16 def pfork4(fun, &b) Open4.do_popen(b, :block) do |ps_read, _| ps_read.close begin fun.call rescue SystemExit => e # Make it seem to the caller that calling Kernel#exit in +fun+ kills # the child process normally. Kernel#exit! bypasses this rescue # block. exit! e.status else exit! 0 end end end