tags:

views:

31

answers:

1

I'm generating a data feed on the local machine, that I want to pipe into a remote process via Net::SSH.

Something like

echo foosball | sed 's/foo/bar/g'

Just that the echo foosball part would be the data feed on the local machine.

What I'm NOT looking for is:

data = "foosball"
ssh.exec!("echo #{data} | sed 's/foo/bar/g'")

I really want a stream of data piped into the process in real time ;)

A: 

Instead of Net:SSH, you can pipe through ssh (just make your local process puts the data to STDOUT), so this should work (I tested with normal commands):

./local_process | ssh user@domain ./remote_process

This assumes your that local_process and remote_process are executable and remote_process is stored on your home directory on the remote machine.

ehsanul