File: stream.go

package info (click to toggle)
golang-github-hashicorp-go-plugin 1.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 552 kB
  • sloc: python: 38; makefile: 4
file content (18 lines) | stat: -rw-r--r-- 340 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package plugin

import (
	"io"
	"log"
)

func copyStream(name string, dst io.Writer, src io.Reader) {
	if src == nil {
		panic(name + ": src is nil")
	}
	if dst == nil {
		panic(name + ": dst is nil")
	}
	if _, err := io.Copy(dst, src); err != nil && err != io.EOF {
		log.Printf("[ERR] plugin: stream copy '%s' error: %s", name, err)
	}
}