github.com/hashicorp/go-plugin@v1.6.0/stream.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  package plugin
     5  
     6  import (
     7  	"io"
     8  	"log"
     9  )
    10  
    11  func copyStream(name string, dst io.Writer, src io.Reader) {
    12  	if src == nil {
    13  		panic(name + ": src is nil")
    14  	}
    15  	if dst == nil {
    16  		panic(name + ": dst is nil")
    17  	}
    18  	if _, err := io.Copy(dst, src); err != nil && err != io.EOF {
    19  		log.Printf("[ERR] plugin: stream copy '%s' error: %s", name, err)
    20  	}
    21  }