infra
/
goutils
Archived
1
0
Fork 0
This repository has been archived on 2022-04-06. You can view files and clone it, but cannot push or open issues or pull requests.
goutils/io/reader_writer.go

26 lines
383 B
Go

package io
import (
"io"
"context"
)
type WrappedIO struct {
stdin io.Reader
stdout io.Writer
closer context.CancelFunc
}
func (wio *WrappedIO) Read(p []byte) (n int, err error) {
return wio.stdin.Read(p)
}
func (wio *WrappedIO) Write(p []byte) (n int, err error) {
return wio.stdout.Write(p)
}
func (wio *WrappedIO) Close() (err error) {
wio.closer()
return io.EOF
}