From: Dawa Ometto Date: 2010-03-05T22:42:25+09:00 Subject: Net/ssh & send_data Hi, I would like to use the net/ssh gem to connect to an ssh server, execute a command, and send data to the command's standard input. So far I've managed to do this using the on_data callback: ch.exec "mycommand" do |ch, success| ch.on_data do |ch, data| #Wait for invitation on std-out and send message on std-in output << data if input != nil then ch.send_data(input.gsub("\n","\r")+"\n") #Fix to prevent multi line data from ending the data stream, append newline end end end However, this is slightly suboptimal - it means that the listening script has to send something to standard out before I can send data to it's stdin. Does anyone have clue how this can be implemented without using the on_data callback? Kind regards, Dawa -- Helpdesk Wijsbegeerte http://helpdesk.phil.uu.nl Bestuursgebouw, kamer 187 Tel. (030-253)7779, bgg 2817