package ioset
import "github.com/docker/buildx/util/ioset"
Index ¶
- func Pipe() (In, Out)
- type Forwarder
- func NewForwarder() *Forwarder
- func (f *Forwarder) Close() (retErr error)
- func (f *Forwarder) SetIn(in *In)
- func (f *Forwarder) SetOut(out *Out)
- type In
- type MuxIO
- func NewMuxIO(in In, outs []MuxOut, initIdx int, toggleMessage func(prev int, res int) string) *MuxIO
- func (m *MuxIO) Disable(i int) error
- func (m *MuxIO) Enable(i int)
- func (m *MuxIO) SwitchTo(i int) error
- type MuxOut
- type Out
- type SingleForwarder
Functions ¶
func Pipe ¶
Pipe returns a pair of piped readers and writers collection. They are useful for controlling stdio stream using Forwarder function.
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
func (*Forwarder) Close ¶
func (*Forwarder) SetIn ¶
func (*Forwarder) SetOut ¶
type In ¶
type In struct { Stdin io.ReadCloser Stdout io.WriteCloser Stderr io.WriteCloser }
func (In) Close ¶
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.
func (*MuxIO) Disable ¶
func (*MuxIO) Enable ¶
func (*MuxIO) SwitchTo ¶
type MuxOut ¶
type MuxOut struct { Out EnableHook func() DisableHook func() }
type Out ¶
type Out struct { Stdin io.WriteCloser Stdout io.ReadCloser Stderr io.ReadCloser }
func (Out) Close ¶
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.
Source Files ¶
- Version
- v0.22.0 (latest)
- Published
- Mar 17, 2025
- Platform
- linux/amd64
- Imports
- 6 packages
- Last checked
- 3 weeks ago –
Tools for package owners.