1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test_io_console.rb: use gets

* test/io/console/test_io_console.rb (run_pty): pty cannot read
  all, should use gets only.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-12-25 06:17:49 +00:00
parent 44e0cd19df
commit 913943270d

View file

@ -249,12 +249,13 @@ class TestIO_Console < Test::Unit::TestCase
s.close if s
end
def run_pty(src)
def run_pty(src, n = 1)
r, w, pid = PTY.spawn(EnvUtil.rubybin, "-rio/console", "-e", src)
rescue RuntimeError
skip $!
else
result = r.readlines.map(&:chomp)
result = []
n.times {result << r.gets.chomp}
Process.wait(pid)
if block_given?
yield result