mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/net/telnet.rb (cmd): Pass FailEOF options: patch by Brian Candler [ruby-core:22723]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
98bcdc60ab
commit
c2c679bc38
2 changed files with 9 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Fri Oct 9 00:33:29 2009 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
|
||||||
|
|
||||||
|
* lib/net/telnet.rb (cmd): Pass FailEOF options: patch by Brian
|
||||||
|
Candler [ruby-core:22723]
|
||||||
|
|
||||||
Fri Oct 9 00:01:17 2009 Tanaka Akira <akr@fsij.org>
|
Fri Oct 9 00:01:17 2009 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* ext/socket/lib/socket.rb (Socket.udp_server_recv): extracted from
|
* ext/socket/lib/socket.rb (Socket.udp_server_recv): extracted from
|
||||||
|
|
|
@ -681,20 +681,22 @@ module Net
|
||||||
def cmd(options) # :yield: recvdata
|
def cmd(options) # :yield: recvdata
|
||||||
match = @options["Prompt"]
|
match = @options["Prompt"]
|
||||||
time_out = @options["Timeout"]
|
time_out = @options["Timeout"]
|
||||||
|
fail_eof = @options["FailEOF"]
|
||||||
|
|
||||||
if options.kind_of?(Hash)
|
if options.kind_of?(Hash)
|
||||||
string = options["String"]
|
string = options["String"]
|
||||||
match = options["Match"] if options.has_key?("Match")
|
match = options["Match"] if options.has_key?("Match")
|
||||||
time_out = options["Timeout"] if options.has_key?("Timeout")
|
time_out = options["Timeout"] if options.has_key?("Timeout")
|
||||||
|
fail_eof = options["FailEOF"] if options.has_key?("FailEOF")
|
||||||
else
|
else
|
||||||
string = options
|
string = options
|
||||||
end
|
end
|
||||||
|
|
||||||
self.puts(string)
|
self.puts(string)
|
||||||
if block_given?
|
if block_given?
|
||||||
waitfor({"Prompt" => match, "Timeout" => time_out}){|c| yield c }
|
waitfor({"Prompt" => match, "Timeout" => time_out, "FailEOF" => fail_eof}){|c| yield c }
|
||||||
else
|
else
|
||||||
waitfor({"Prompt" => match, "Timeout" => time_out})
|
waitfor({"Prompt" => match, "Timeout" => time_out, "FailEOF" => fail_eof})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue