Sha256: 757b1e6db69eb9747fbdd42633e34221a59849ba9ef1e42531ff151ad12c2406
Contents?: true
Size: 893 Bytes
Versions: 1
Compression:
Stored size: 893 Bytes
Contents
module RestAssured module Utils class Subprocess attr_reader :pid def initialize @pid = Kernel.fork do trap('USR1') do Process.kill('TERM', Process.pid) # unlike 'exit' this one is NOT being intercepted by Webrick end at_exit { exit! } begin yield rescue => e if defined?(EventMachine) && e.is_a?(EventMachine::ConnectionNotBound) retry end puts "#{self} has raised #{e.inspect}:" puts e.backtrace.join("\n") end end Process.detach(@pid) at_exit { stop } end def alive? Process.kill(0, @pid) true rescue Errno::ESRCH false end def stop Process.kill('USR1', @pid) rescue Errno::ESRCH # no such process end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rest-assured-1.1.0 | lib/rest-assured/utils/subprocess.rb |