Because the descrption say it returns a learn finish of the pipe. Nevertheless i used to be anticipating it to assign the write finish to sesssion.Stdout
. Shall we say I need to redirect stderr to similar pipe for frequent reader consumption.
Instance: sesssion.Stderr = session.Stdout
. However after StdoutPipe()
, sesssion.Stdout
remains to be nil
I’m I lacking one thing right here?
// StdoutPipe returns a pipe that will likely be related to the
// distant command's normal output when the command begins.
// There's a fastened quantity of buffering that's shared between
// stdout and stderr streams. If the StdoutPipe reader is
// not serviced quick sufficient it might ultimately trigger the
// distant command to dam.
func (s *Session) StdoutPipe() (io.Reader, error) {
if s.Stdout != nil {
return nil, errors.New("ssh: Stdout already set")
}
if s.began {
return nil, errors.New("ssh: StdoutPipe after course of began")
}
s.stdoutpipe = true
return s.ch, nil
}