code: func StreamContainerIO(r io.Reader, errOutput *string, log func(string)) <-chan struct{} {
  	c := make(chan struct{}, 1)
  	go func() {
  		reader := bufio.NewReader(r)
  		for {
  			text, err := reader.ReadString('\n')
  			if text != "" {
  				log(text)
  			}
  			if errOutput != nil && len(*errOutput) < maxErrorOutput {
  				*errOutput += text + "\n"
  			}
  			if err != nil {
  				if glog.Is(2) && err != io.EOF {
  					glog.V(0).Infof("error: Error reading docker stdout/stderr: %#v", err)
  				}
  				break
  			}
  		}
  		close(c)
  	}()
  	return c
  }
docs: // end block of 3 methods borrowed from go-dockerclient
  // StreamContainerIO starts a goroutine to take data from the reader and
  // redirect it to the log function (typically we pass in glog.Error for stderr
  // and glog.Info for stdout. The caller should wrap glog functions in a closure
  // to ensure accurate line numbers are reported:
  // https://github.com/openshift/source-to-image/issues/558 .
  // StreamContainerIO returns a channel which is closed after the reader is
  // closed.