Dear community,
I'm currently trying to write a simple ssh client using
golang.org/x/crypto/ssh.
My question is:
When using ssh.Session.Stdin, which is an io.Reader interface, what
triggers a call to the actual Read method?
I seem to lack some fundamentals understanding of how this works, I just
can't seem to get my head around it.
I tried:
1)
session.Stdin = os.Stdin // here when I press a key it gets transmitted to
the SSH server - how is this possible!? since session.Stdin is just a
reader, what triggers a call to the Read method?
2)
buf := bytes.NewBufferString("\n\nshow version\n")
session.Stdin = buf // here only the first (two) bytes are sent -- why?
Playground: https://play.golang.org/p/KTa_FbJCXWU
My reason for this post is first to gain an understanding about how
session.Stdin might work. In the long run I would like to be able to
execute an arbitrary command on a Cisco IOS device. This already works for
commands with "short" outputs, however when issuing longer commands ("show
run"), I always receive this error message:
*wait: remote command exited without exit status or exit signal*
Any help, hints, tips or suggestions are really appreciated!
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/1b6ee3de-3b42-4198-aaf3-a2162209d2ban%40googlegroups.com.