* sc3983...@gmail.com <sc3983...@gmail.com> [200915 11:41]: > Hi Everyone: > > I have the same problem, How do I get user input command, with *SSH > client with a Interactive Shell* > > 在 2018年10月23日星期二 UTC+8上午4:57:50,Sun Frank写道: > > > > Hi Everyone: > > > > I came across a problem which puzzled me for couple of days. I am trying > > to write a* SSH client with a Interactive Shell *using golang, but i also > > need to record the command(or keystroke history) of the user typed, like > > the history feature, here's my working code: > > [snip] > > > > session.Stdout = os.Stdout > > session.Stderr = os.Stderr > > session.Stdin = os.Stdin
Instead of using os.Stdin, create an io.Pipe, and use the returned *PipeReader for session.Stdin. Then, read os.Stdin yourself, log or otherwise process the user's input, and write the processed input to the *PipeWriter. The same technique can be used to log Stdout and Stderr. ...Marvin -- 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 golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/20200915162707.o4zssrpgikspxomc%40basil.wdw.