func()

in internal/command/githttp/pull.go [94:123]


func (c *PullCommand) readFromStdin(pw *io.PipeWriter, geoProxyFetchDirectToPrimaryWithOptions bool) {
	scanner := pktline.NewScanner(c.ReadWriter.In)

	for scanner.Scan() {
		line := scanner.Bytes()

		_, err := pw.Write(line)
		if err != nil {
			log.WithError(err).Error("failed to write line")
		}

		if pktline.IsDone(line) {
			break
		}

		if pktline.IsFlush(line) && geoProxyFetchDirectToPrimaryWithOptions {
			_, err := pw.Write(pktline.PktDone())
			if err != nil {
				log.WithError(err).Error("failed to write packet done line")
			}

			break
		}
	}

	err := pw.Close()
	if err != nil {
		log.WithError(err).Error("failed to close writer")
	}
}