From bc1bfb6997c1219d60b150531b6547c966d87fdd Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 19 Jun 2013 07:47:19 +0000 Subject: test_curses.rb: reap zombie * test/test_curses.rb (TestCurses#run_curses): reap zombie, since PTY.spawn with block does not wait the sub process but just detaches. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/test_curses.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/test_curses.rb b/test/test_curses.rb index 7bcb172e96..d43c852f2f 100644 --- a/test/test_curses.rb +++ b/test/test_curses.rb @@ -15,7 +15,7 @@ end if defined? Curses class TestCurses def run_curses(src, input = nil, timeout: 1) - PTY.spawn({"TERM"=>ENV["TERM"]||"dumb"}, EnvUtil.rubybin, "-e", <<-"src") {|r, w, pid| + r, w, pid = PTY.spawn({"TERM"=>ENV["TERM"]||"dumb"}, EnvUtil.rubybin, "-e", <<-"src") require 'timeout' require 'curses' include Curses @@ -33,6 +33,7 @@ ensure $stdio.flush end src + begin wait = r.readpartial(1) if wait != "!" wait << r.readpartial(1000) @@ -48,7 +49,11 @@ src res, error = Marshal.load(res[/(.*)\Z/, 1].unpack('m')[0]) raise error if error return res - } + ensure + r.close unless r.closed? + w.close unless w.closed? + Process.wait(pid) + end end def test_getch -- cgit v1.2.3