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:
parent
44e0cd19df
commit
913943270d
1 changed files with 3 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue