github.com/leowmjw/otto@v0.2.1-0.20160126165905-6400716cf085/rpc/stream.go (about)

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