PATH:
opt
/
alt
/
ruby26
/
lib64
/
ruby
/
2.6.0
# frozen_string_literal: true $expect_verbose = false # Expect library adds the IO instance method #expect, which does similar act to # tcl's expect extension. # # In order to use this method, you must require expect: # # require 'expect' # # Please see #expect for usage. class IO # call-seq: # IO#expect(pattern,timeout=9999999) -> Array # IO#expect(pattern,timeout=9999999) { |result| ... } -> nil # # Reads from the IO until the given +pattern+ matches or the +timeout+ is over. # # It returns an array with the read buffer, followed by the matches. # If a block is given, the result is yielded to the block and returns nil. # # When called without a block, it waits until the input that matches the # given +pattern+ is obtained from the IO or the time specified as the # timeout passes. An array is returned when the pattern is obtained from the # IO. The first element of the array is the entire string obtained from the # IO until the pattern matches, followed by elements indicating which the # pattern which matched to the anchor in the regular expression. # # The optional timeout parameter defines, in seconds, the total time to wait # for the pattern. If the timeout expires or eof is found, nil is returned # or yielded. However, the buffer in a timeout session is kept for the next # expect call. The default timeout is 9999999 seconds. def expect(pat,timeout=9999999) buf = ''.dup case pat when String e_pat = Regexp.new(Regexp.quote(pat)) when Regexp e_pat = pat else raise TypeError, "unsupported pattern class: #{pat.class}" end @unusedBuf ||= '' while true if not @unusedBuf.empty? c = @unusedBuf.slice!(0) elsif !IO.select([self],nil,nil,timeout) or eof? then result = nil @unusedBuf = buf break else c = getc end buf << c if $expect_verbose STDOUT.print c STDOUT.flush end if mat=e_pat.match(buf) then result = [buf,*mat.captures] break end end if block_given? then yield result else return result end nil end end
[+]
rinda
[+]
yaml
[+]
bundler
[+]
thwait
[-] matrix.rb
[edit]
[+]
rdoc
[-] shell.rb
[edit]
[-] ostruct.rb
[edit]
[-] scanf.rb
[edit]
[+]
ripper
[-] rdoc.rb
[edit]
[-] coverage.rb
[edit]
[-] getoptlong.rb
[edit]
[-] sync.rb
[edit]
[-] delegate.rb
[edit]
[-] open-uri.rb
[edit]
[-] json.rb
[edit]
[-] rubygems.rb
[edit]
[-] openssl.rb
[edit]
[+]
json
[-] debug.rb
[edit]
[+]
irb
[-] bigdecimal.rb
[edit]
[-] digest.rb
[edit]
[-] yaml.rb
[edit]
[-] forwardable.rb
[edit]
[+]
csv
[-] weakref.rb
[edit]
[-] benchmark.rb
[edit]
[-] profiler.rb
[edit]
[-] uri.rb
[edit]
[-] English.rb
[edit]
[+]
syslog
[-] timeout.rb
[edit]
[-] tracer.rb
[edit]
[-] resolv.rb
[edit]
[+]
uri
[-] tsort.rb
[edit]
[-] find.rb
[edit]
[-] logger.rb
[edit]
[-] psych.rb
[edit]
[+]
psych
[-] profile.rb
[edit]
[-] optparse.rb
[edit]
[+]
matrix
[-] pp.rb
[edit]
[-] date.rb
[edit]
[-] cmath.rb
[edit]
[-] ripper.rb
[edit]
[-] fiddle.rb
[edit]
[+]
drb
[+]
io
[+]
webrick
[+]
unicode_normalize
[-] cgi.rb
[edit]
[-] pathname.rb
[edit]
[-] mutex_m.rb
[edit]
[+]
rss
[+]
racc
[+]
forwardable
[+]
..
[-] prettyprint.rb
[edit]
[-] csv.rb
[edit]
[-] kconv.rb
[edit]
[-] securerandom.rb
[edit]
[+]
fiddle
[-] abbrev.rb
[edit]
[-] resolv-replace.rb
[edit]
[+]
digest
[+]
rexml
[-] optionparser.rb
[edit]
[-] e2mmap.rb
[edit]
[-] shellwords.rb
[edit]
[-] rss.rb
[edit]
[-] time.rb
[edit]
[+]
openssl
[-] fileutils.rb
[edit]
[-] socket.rb
[edit]
[+]
net
[-] monitor.rb
[edit]
[+]
tracer
[-] tempfile.rb
[edit]
[-] un.rb
[edit]
[-] mkmf.rb
[edit]
[-] base64.rb
[edit]
[-] thwait.rb
[edit]
[-] webrick.rb
[edit]
[-] erb.rb
[edit]
[+]
shell
[-] expect.rb
[edit]
[+]
e2mmap
[-] open3.rb
[edit]
[+]
cgi
[-] tmpdir.rb
[edit]
[-] ipaddr.rb
[edit]
[-] pstore.rb
[edit]
[-] singleton.rb
[edit]
[+]
rubygems
[-] set.rb
[edit]
[-] observer.rb
[edit]
[-] bundler.rb
[edit]
[-] drb.rb
[edit]
[+]
fileutils
[-] irb.rb
[edit]
[-] prime.rb
[edit]
[+]
x86_64-linux
[+]
optparse