Maintenance of Ruby 2.0.0 ended on February 24, 2016. Read more
# File test/unit.rb, line 314 def close @io.close unless @io.closed? self rescue IOError end
# File test/unit.rb, line 332 def died(*additional) @status = :quit @io.close call_hook(:dead,*additional) end
# File test/unit.rb, line 303 def hook(id,&block) @hooks[id] ||= [] @hooks[id] << block self end
# File test/unit.rb, line 327 def kill Process.kill(:KILL, @pid) rescue Errno::ESRCH end
# File test/unit.rb, line 283 def puts(*args) @io.puts(*args) end
# File test/unit.rb, line 320 def quit return if @io.closed? @quit_called = true @io.puts "quit" @io.close end
# File test/unit.rb, line 309 def read res = (@status == :quit) ? @io.read : @io.gets res && res.chomp end
# File test/unit.rb, line 287 def run(task,type) @file = File.basename(task, ".rb") @real_file = task begin puts "loadpath #{[Marshal.dump($:-@loadpath)].pack("m0")}" @loadpath = $:.dup puts "run #{task} #{type}" @status = :prepare rescue Errno::EPIPE died rescue IOError raise unless ["stream closed","closed stream"].include? $!.message died end end