How to use Net::SSH for piping?

Hi, I’ve got a bit of a problem here.

Here’s the setup, I’m proxying a remote command through a unix socket:

  1. Started an SSH session to a remote host using Net::SSH
  2. Created an UNIXServer and now am accepting connections
  3. A new connection arrives
  4. Want to pipe the connection’s out to a remote commands’ in, and vice
    versa
    Preferably using a new SSH channel and not a whole session.

E.g. the remote command would be lame - -, encoding wav files to mp3,
and then I would pipe a wav to the proxy and get an mp3 out like this:
socat - UNIX-CONNECT:local_socket < my.wav > my.mp3

What’s the correct way to do the piping to the command and back with
Net::SSH?

Thanks in advance,
Ilmari

Here’s the setup, I’m proxying a remote command through a unix socket:

  1. Started an SSH session to a remote host using Net::SSH
  2. Created an UNIXServer and now am accepting connections
  3. A new connection arrives
  4. Want to pipe the connection’s out to a remote commands’ in, and vice
    versa
    Preferably using a new SSH channel and not a whole session.

I went with using IO.popen(“ssh #{host}
#{create_proxy_script_for(filename)}”)
for now, couldn’t figure out how to do it with Net::SSH
(session.process.popen3 lacked .close_write, and trying to send data
in a blocking fashion with process.open took too much hacking of the
library internals (and I couldn’t get it working in the end))

Oh well. It’s slow and cumbersome, but at least it works in the
interim. Need to figure out a better way at some point.