http://www.perlmonks.org?node_id=1038432


in reply to Re: Is it possible to see what Net::OpenSSH is doing?
in thread Is it possible to see what Net::OpenSSH is doing?

Hm, I was thinking with the ability to make an interactive shell with Expect, and then the ability to type/send commands and get/receive that command's output, maybe I could get that interactive shell and somehow have Net::OpenSSH type/send commands to the shell rather than me. I even tried setting master_stdout(stderr)_fh's to the pty device, but obviously that didn't work. I thought I was on to something a bit ago, but kept ending with the error 'Error: could not connect pty as controlling terminal'. Darn.

  • Comment on Re^2: Is it possible to see what Net::OpenSSH is doing?

Replies are listed 'Best First'.
Re^3: Is it possible to see what Net::OpenSSH is doing?
by salva (Canon) on Jun 12, 2013 at 11:34 UTC
    Net::OpenSSH does not send commands to a shell.

    A possible way, quite difficult, may be to abuse the OSTracer interface that allows to run the master ssh process with strace (or your favourite OS equivalent).

    You will have to write your own tracer able to dump the IO interactions of the ssh master process to the console.

      I just realized you wrote this module. Thank you. I've been using Expect for years. I just started using Net::OpenSSH recently, and it has really made my life a lot easier. I'm looking at strace output as well as OSTracer to see what I can come up with. I will post back here with any results (i.e., don't expect me to post back here).