amuz.es/src/infra/goutils@v0.1.3/io/reader_writer.go (about)

     1  package io
     2  
     3  import (
     4  	"io"
     5  	"context"
     6  )
     7  
     8  type WrappedIO struct {
     9  	stdin  io.Reader
    10  	stdout io.Writer
    11  	closer context.CancelFunc
    12  }
    13  
    14  func (wio *WrappedIO) Read(p []byte) (n int, err error) {
    15  	return wio.stdin.Read(p)
    16  }
    17  
    18  func (wio *WrappedIO) Write(p []byte) (n int, err error) {
    19  	return wio.stdout.Write(p)
    20  }
    21  
    22  func (wio *WrappedIO) Close() (err error) {
    23  	wio.closer()
    24  	return io.EOF
    25  }