output

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MultiWriter

func MultiWriter(writers ...io.Writer) io.Writer

MultiWriter creates a writer that duplicates its writes to all the provided writers, similar to the Unix tee(1) command.

Each write is written to each listed writer, one at a time. If a listed writer returns an error, that overall write operation stops and returns the error; it does not continue down the list.

func NewCockpitOutputWriter

func NewCockpitOutputWriter(t *task.Task, w io.Writer, close chan bool) *cockpitOutputDecorator

func NewPrefixedOutputWriter

func NewPrefixedOutputWriter(t *task.Task, w io.Writer) *prefixedOutputDecorator

Types

type DecoratedOutputWriter

type DecoratedOutputWriter interface {
	io.Writer // *SafeWriter
	WriteHeader() error
	WriteFooter() error
}

DecoratedOutputWriter is a decorator for task output. It extends io.Writer with methods to write header before output starts and footer after execution completes

type OutputEnum

type OutputEnum string
const (
	RawOutput      OutputEnum = "raw"
	CockpitOutput  OutputEnum = "cockpit"
	PrefixedOutput OutputEnum = "prefixed"
)

type SafeWriter

type SafeWriter struct {
	// contains filtered or unexported fields
}

SafeWriter is a go routine safe implementation of any io.Writer.

Outside of os.File no other writer is concurrency safe,

bytes.Buffer, and so on will need a concurrency lock on writes, and reads

func NewSafeWriter

func NewSafeWriter(writerImpl io.Writer) *SafeWriter

NewSafeWriter initiates a new concurrency safe writer

func (*SafeWriter) Len

func (tw *SafeWriter) Len() int

Len returns the currently written bytes length Currently only used in tests

func (*SafeWriter) String

func (tw *SafeWriter) String() string

String returns the stringified version of bytes written Currently only used in tests

func (*SafeWriter) Write

func (tw *SafeWriter) Write(p []byte) (n int, err error)

type TaskOutput

type TaskOutput struct {
	// contains filtered or unexported fields
}

TaskOutput connects given task with requested decorator

func NewTaskOutput

func NewTaskOutput(t *task.Task, format string, stdout, stderr io.Writer) (*TaskOutput, error)

NewTaskOutput creates new TaskOutput instance for given task.

func (*TaskOutput) Close

func (t *TaskOutput) Close()

Close releases resources and closes underlying decorators

func (TaskOutput) Finish

func (o TaskOutput) Finish() error

Finish should be called after task completes

func (TaskOutput) Start

func (o TaskOutput) Start() error

Start should be called before task's output starts

func (*TaskOutput) Stderr

func (o *TaskOutput) Stderr() io.Writer

Stderr returns io.Writer that can be used for Job's STDERR

func (*TaskOutput) Stdout

func (o *TaskOutput) Stdout() io.Writer

Stdout returns io.Writer that can be used for Job's STDOUT

func (*TaskOutput) WithCloseCh

func (t *TaskOutput) WithCloseCh(closeCh chan bool) *TaskOutput

Jump to

Keyboard shortcuts

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