Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Forwarder ¶
type Forwarder struct { // PropagateStdinClose indicates whether EOF from Stdin of Out should be propagated. // If this is true, EOF from Stdin (reader) of Out closes Stdin (writer) of In. PropagateStdinClose bool // contains filtered or unexported fields }
Forwarder forwards IO between readers and writers contained in In and Out structs. In and Out can be changed during forwarding using SetIn and SetOut methods.
func NewForwarder ¶
func NewForwarder() *Forwarder
type In ¶
type In struct { Stdin io.ReadCloser Stdout io.WriteCloser Stderr io.WriteCloser }
type MuxIO ¶
type MuxIO struct {
// contains filtered or unexported fields
}
func NewMuxIO ¶
func NewMuxIO(in In, outs []MuxOut, initIdx int, toggleMessage func(prev int, res int) string) *MuxIO
NewMuxIO forwards IO stream to/from "in" and "outs". It toggles IO when it detects "C-a-c" key. "outs" are closed automatically when "in" reaches EOF. "in" doesn't closed automatically so the caller needs to explicitly close it.
type Out ¶
type Out struct { Stdin io.WriteCloser Stdout io.ReadCloser Stderr io.ReadCloser }
type SingleForwarder ¶
type SingleForwarder struct {
// contains filtered or unexported fields
}
SingleForwarder forwards IO from a reader to a writer. The reader and writer can be changed during forwarding using SetReader and SetWriter methods.
func NewSingleForwarder ¶
func NewSingleForwarder() *SingleForwarder
func (*SingleForwarder) Close ¶
func (f *SingleForwarder) Close() (retErr error)
Close closes the both of registered reader and writer and finishes the forwarder.
func (*SingleForwarder) SetReader ¶
func (f *SingleForwarder) SetReader(r io.ReadCloser)
SetWriter sets the specified reader as the forward source.
func (*SingleForwarder) SetWriter ¶
func (f *SingleForwarder) SetWriter(w io.WriteCloser, curWEOFHandler func() io.WriteCloser)
SetWriter sets the specified writer as the forward destination. If curWEOFHandler isn't nil, this will be called when the current reader returns EOF.