ruby-changes:29365
From: nobu <ko1@a...>
Date: Wed, 19 Jun 2013 16:47:39 +0900 (JST)
Subject: [ruby-changes:29365] nobu:r41418 (trunk): test_curses.rb: reap zombie
nobu 2013-06-19 16:47:19 +0900 (Wed, 19 Jun 2013) New Revision: 41418 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41418 Log: 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. Modified files: trunk/test/test_curses.rb Index: test/test_curses.rb =================================================================== --- test/test_curses.rb (revision 41417) +++ test/test_curses.rb (revision 41418) @@ -15,7 +15,7 @@ end if defined? Curses https://github.com/ruby/ruby/blob/trunk/test/test_curses.rb#L15 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 https://github.com/ruby/ruby/blob/trunk/test/test_curses.rb#L33 $stdio.flush end src + begin wait = r.readpartial(1) if wait != "!" wait << r.readpartial(1000) @@ -48,7 +49,11 @@ src https://github.com/ruby/ruby/blob/trunk/test/test_curses.rb#L49 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/