Dear community,
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?
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!