diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-19 07:47:19 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-19 07:47:19 +0000 |
commit | bc1bfb6997c1219d60b150531b6547c966d87fdd (patch) | |
tree | 8e76fd1bcf0e254b92c0e3f0d4f4ae05ed3631cc /test/test_curses.rb | |
parent | 4f95e22d9c11ed8a29e3a728cc1fc20afc963353 (diff) |
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
Diffstat (limited to 'test/test_curses.rb')
-rw-r--r-- | test/test_curses.rb | 9 |
1 files 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 |