code: func (s *Session) Wait() error {
  	if !s.started {
  		return errors.New("ssh: session not started")
  	}
  	waitErr := <-s.exitStatus
  
  	if s.stdinPipeWriter != nil {
  		s.stdinPipeWriter.Close()
  	}
  	var copyError error
  	for _ = range s.copyFuncs {
  		if err := <-s.errors; err != nil && copyError == nil {
  			copyError = err
  		}
  	}
  	if waitErr != nil {
  		return waitErr
  	}
  	return copyError
  }
docs: // Wait waits for the remote command to exit.
  //
  // The returned error is nil if the command runs, has no problems
  // copying stdin, stdout, and stderr, and exits with a zero exit
  // status.
  //
  // If the command fails to run or doesn't complete successfully, the
  // error is of type *ExitError. Other error types may be
  // returned for I/O problems.