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
This commit is contained in:
parent
4f95e22d9c
commit
bc1bfb6997
@ -15,7 +15,7 @@ end if defined? Curses
|
|||||||
|
|
||||||
class TestCurses
|
class TestCurses
|
||||||
def run_curses(src, input = nil, timeout: 1)
|
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 'timeout'
|
||||||
require 'curses'
|
require 'curses'
|
||||||
include Curses
|
include Curses
|
||||||
@ -33,6 +33,7 @@ ensure
|
|||||||
$stdio.flush
|
$stdio.flush
|
||||||
end
|
end
|
||||||
src
|
src
|
||||||
|
begin
|
||||||
wait = r.readpartial(1)
|
wait = r.readpartial(1)
|
||||||
if wait != "!"
|
if wait != "!"
|
||||||
wait << r.readpartial(1000)
|
wait << r.readpartial(1000)
|
||||||
@ -48,7 +49,11 @@ src
|
|||||||
res, error = Marshal.load(res[/(.*)\Z/, 1].unpack('m')[0])
|
res, error = Marshal.load(res[/(.*)\Z/, 1].unpack('m')[0])
|
||||||
raise error if error
|
raise error if error
|
||||||
return res
|
return res
|
||||||
}
|
ensure
|
||||||
|
r.close unless r.closed?
|
||||||
|
w.close unless w.closed?
|
||||||
|
Process.wait(pid)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_getch
|
def test_getch
|
||||||
|
Loading…
x
Reference in New Issue
Block a user