I'm perplexed as to why I can run the following just fine from a command line, but when I try to execute from a web browser it crashes.
>From the command line it prints out... <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><HTML><BODY><H3>FlyBOB Control Panel</H3><P>cmd=>[echo 'THIS IS A TEST FROM THE REMOTE SHELL'] got stdout: THIS IS A TEST FROM THE REMOTE SHELL cmd=>[echo 'THIS IS A TEST FROM THE REMOTE SHELL'] closing!</P></BODY></HTML> Which means if this text is rendered in a web environment it should print THIS IS A TEST FROM THE REMOTE SHELL Does anyone know why you can't call net/ssh from a CGI or how to debug this in a browser environment? ----------------------------- ruby cgi script --------------------------------- require 'cgi' require 'rubygems' require 'net/ssh' def do_sync_cmd( session, command ) session.open_channel do |channel| channel.env("PATH", "/usr/pbs/bin:/acct/uzer/test/bin") channel.exec("#{command}") do |ch, success| abort @myString.concat("could not execute #{command}") unless success channel.on_data do |ch, data| @myString.concat("cmd=>[#{command}] got stdout: \n#{data}") channel.send_data "something for stdin\n" end channel.on_extended_data do |ch, type, data| @myString.concat("cmd=>[#{command}] stderr: \n#{data}") end channel.on_close do |ch| @myString.concat("cmd=>[#{command}] closing!\n\n") end end end session.loop end @myString = "XXX" Net::SSH.start('myserver.com', 'uzer') do |session| do_sync_cmd session, "cd /acct/uzer/test/bin && ls -l" end cgi = CGI.new('html4') params = cgi.params cgi.out { cgi.html { cgi.head { cgi.title {'Test Control Panel v0.1'}} cgi.body { cgi.h3 {'Test Control Panel'} + cgi.p {"[EMAIL PROTECTED]"} } } } -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---