* ext/pty/lib/expect.rb: preserve buffer read, instead of discard.
based on a patch from Luiz Angelo Daros de Luca in [ruby-core:23464]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d124dcf4eb
commit
5869de449f
@ -1,3 +1,9 @@
|
|||||||
|
Sat Apr 10 00:01:51 2010 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
|
* ext/pty/lib/expect.rb: preserve buffer read, instead of discard.
|
||||||
|
based on a patch from Luiz Angelo Daros de Luca in
|
||||||
|
[ruby-core:23464].
|
||||||
|
|
||||||
Fri Apr 9 23:58:58 2010 Yusuke Endoh <mame@tsg.ne.jp>
|
Fri Apr 9 23:58:58 2010 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
* ext/pty/lib/expect.rb: raise an error when argument is unexpected
|
* ext/pty/lib/expect.rb: raise an error when argument is unexpected
|
||||||
|
@ -17,12 +17,17 @@ class IO
|
|||||||
else
|
else
|
||||||
raise TypeError, "unsupported pattern class: #{pattern.class}"
|
raise TypeError, "unsupported pattern class: #{pattern.class}"
|
||||||
end
|
end
|
||||||
|
@unusedBuf ||= ''
|
||||||
while true
|
while true
|
||||||
if !IO.select([self],nil,nil,timeout) or eof? then
|
if not @unusedBuf.empty?
|
||||||
|
c = @unusedBuf.slice!(0).chr
|
||||||
|
elsif !IO.select([self],nil,nil,timeout) or eof? then
|
||||||
result = nil
|
result = nil
|
||||||
|
@unusedBuf = buf
|
||||||
break
|
break
|
||||||
|
else
|
||||||
|
c = getc.chr
|
||||||
end
|
end
|
||||||
c = getc.chr
|
|
||||||
buf << c
|
buf << c
|
||||||
if $expect_verbose
|
if $expect_verbose
|
||||||
STDOUT.print c
|
STDOUT.print c
|
||||||
|
Loading…
x
Reference in New Issue
Block a user