outerr

package
v0.0.0-...-ebb4f00 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package outerr contains types to record/pass system out-err streams.

Index

Constants

This section is empty.

Variables

View Source
var SystemOutErr = NewStreamOutErr(os.Stdout, os.Stderr)

SystemOutErr is a constant wrapping the standard stdout/stderr streams.

Functions

func NewErrWriter

func NewErrWriter(oe OutErr) io.Writer

NewErrWriter provides an io.Writer implementation for writing to the err stream of an OutErr.

func NewOutWriter

func NewOutWriter(oe OutErr) io.Writer

NewOutWriter provides an io.Writer implementation for writing to the out stream of an OutErr.

Types

type OutErr

type OutErr interface {
	WriteOut([]byte)
	WriteErr([]byte)
}

OutErr is a general consumer of stdout and stderr.

type RecordingOutErr

type RecordingOutErr struct {
	StreamOutErr
	// contains filtered or unexported fields
}

RecordingOutErr is an OutErr capable of recording and returning its contents.

func NewRecordingOutErr

func NewRecordingOutErr() *RecordingOutErr

NewRecordingOutErr initializes a new RecordingOutErr.

func (*RecordingOutErr) Stderr

func (s *RecordingOutErr) Stderr() []byte

Stderr returns the full recorded stderr contents.

func (*RecordingOutErr) Stdout

func (s *RecordingOutErr) Stdout() []byte

Stdout returns the full recorded stdout contents.

type StreamOutErr

type StreamOutErr struct {
	OutWriter, ErrWriter io.Writer
}

StreamOutErr passes the stdout and stderr to two provided writers.

func NewStreamOutErr

func NewStreamOutErr(out, err io.Writer) *StreamOutErr

NewStreamOutErr creates an OutErr from two Writers.

func (*StreamOutErr) WriteErr

func (s *StreamOutErr) WriteErr(buf []byte)

WriteErr writes the given bytes to stderr.

func (*StreamOutErr) WriteOut

func (s *StreamOutErr) WriteOut(buf []byte)

WriteOut writes the given bytes to stdout.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL