I'll say what other people will. This is a watir user group, you'd likely
find more help on the Ruby forum: http://www.ruby-forum.com/forum/ruby
either that or mailing lists for that project.

Cheers,

Charley



On Wed, Jun 8, 2011 at 4:59 PM, Bhavesh <bhavesh1_sha...@yahoo.com> wrote:

> Hi
>
> Ealrier i have Ruby 1.8.* and my code to send command to linux box is
> working fine.
>
> But now i upgraded to Ruby 1.9.2.  So i upgraded needle, setsftp and
> netssh too.
>
> Now same piece of code is not working, it throws error for on_success.
>
> ################
>
>
> def issueCommandInKazBox(okMachine="", command="", matchLog="",
> user="admin", passwd="kazeon")
> puts "    issueCommandInKazMachine=#{okMachine}"
> puts "    issueCommandInKazcommand=#{command}"
> puts "    issueCommandInKazstatus=#{matchLog}"
> puts "    issueCommandInKazuser=#{user}"
> puts "    issueCommandInKazpasswd=#{passwd}"
>
> tempString = ""
> Net::SSH.start(okMachine, user, :password => passwd, :paranoid =>
> false ) do |session|
> #Net::SSH.start(okMachine, user, passwd) do |session|
>
>  session.open_channel do |channel|
>
>    channel.on_success do
>      puts "shell was started successfully!"
>
>      puts "Adding command - #{command}..."
>
>      channel.send_data "#{command}\n"
>
>      channel.send_data "exit\n" # tell the shell to exit
>    end
>    channel.on_failure do
>      puts "shell could not be started!"
>    end
>
>    channel.on_data do |ch,data|
>      puts "recieved the following from shell"
>      puts "#{data}"
>      tempString = tempString + "\n" + data
>    end
>
>    channel.on_close do
>      puts "shell terminated"
>    end
>
>    channel.send_request "shell", nil, true
>  end
>  session.loop
> end
>
> #############
>
>
> Can someone let me know what needs to be change to have this working.
>
> Any help is appreciated, im stuck because of this.
>
> Bhavesh
>
> --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> watir-general@googlegroups.com
> http://groups.google.com/group/watir-general
> watir-general+unsubscr...@googlegroups.com
>

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

Reply via email to