Project

General

Profile

Bug #1252 ยป net-telnet-faileof.diff

candlerb (Brian Candler), 03/08/2009 02:58 AM

View differences:

vendor/ruby/lib/net/telnet.rb
682 682
    def cmd(options) # :yield: recvdata
683 683
      match    = @options["Prompt"]
684 684
      time_out = @options["Timeout"]
685
      fail_eof = @options["FailEOF"]
685 686

  
686 687
      if options.kind_of?(Hash)
687 688
        string   = options["String"]
688 689
        match    = options["Match"]   if options.has_key?("Match")
689 690
        time_out = options["Timeout"] if options.has_key?("Timeout")
691
        fail_eof = options["FailEOF"] if options.has_key?("FailEOF")
690 692
      else
691 693
        string = options
692 694
      end
693 695

  
694 696
      self.puts(string)
695 697
      if block_given?
696
        waitfor({"Prompt" => match, "Timeout" => time_out}){|c| yield c }
698
        waitfor({"Prompt" => match, "Timeout" => time_out, "FailEOF" => fail_eof}){|c| yield c }
697 699
      else
698
        waitfor({"Prompt" => match, "Timeout" => time_out})
700
        waitfor({"Prompt" => match, "Timeout" => time_out, "FailEOF" => fail_eof})
699 701
      end
700 702
    end
701 703