Versions in this module Expand all Collapse all v2 v2.0.0 Jun 20, 2026 Changes in this version + var FinishEarly = errors.New("finish stage early") + var IsEPIPE = IsError(syscall.EPIPE) + var IsErrClosedPipe = IsError(io.ErrClosedPipe) + var IsPipeError = AnyError(IsSIGPIPE, IsEPIPE, IsErrClosedPipe) + var IsSIGPIPE = IsSignal(syscall.SIGPIPE) + func ScanLFTerminatedLines(data []byte, atEOF bool) (advance int, token []byte, err error) + type AppendVars func(context.Context, []EnvVar) []EnvVar + type ContextValueFunc func(context.Context) (string, bool) + type ContextValuesFunc func(context.Context) []EnvVar + type Env struct + Dir string + Vars []AppendVars + type EnvVar struct + Key string + Value string + type ErrorFilter func(err error) error + type ErrorMatcher func(err error) bool + func AnyError(ems ...ErrorMatcher) ErrorMatcher + func IsError(target error) ErrorMatcher + func IsSignal(signal syscall.Signal) ErrorMatcher + type Event struct + Command string + Context map[string]interface{} + Err error + Msg string + type FunctionOption func(*goStage) + func ForbidStdin() FunctionOption + func ForbidStdout() FunctionOption + func WithStdinRequirement(requirement StreamRequirement) FunctionOption + func WithStdoutRequirement(requirement StreamRequirement) FunctionOption + type InputStream struct + func ClosingInput(r io.ReadCloser) *InputStream + func Input(r io.Reader) *InputStream + func (s *InputStream) Close() error + func (s *InputStream) Reader() io.Reader + type LinewiseStageFunc func(ctx context.Context, env Env, line []byte, stdout *bufio.Writer) error + type NewPipeFn func(opts ...Option) *Pipeline + type NewScannerFunc func(r io.Reader) (Scanner, error) + type Option func(*Pipeline) + func WithDir(dir string) Option + func WithEnvVar(key, value string) Option + func WithEnvVarFunc(key string, valueFunc ContextValueFunc) Option + func WithEnvVars(b []EnvVar) Option + func WithEnvVarsFunc(valuesFunc ContextValuesFunc) Option + func WithEventHandler(handler func(e *Event)) Option + func WithStagePanicHandler(ph StagePanicHandler) Option + func WithStdin(stdin io.Reader) Option + func WithStdout(stdout io.Writer) Option + func WithStdoutCloser(stdout io.WriteCloser) Option + type OutputStream struct + func ClosingOutput(w io.WriteCloser) *OutputStream + func Output(w io.Writer) *OutputStream + func (s *OutputStream) Close() error + func (s *OutputStream) Writer() io.Writer + type Pipeline struct + func New(options ...Option) *Pipeline + func (p *Pipeline) Add(stages ...Stage) + func (p *Pipeline) AddWithIgnoredError(em ErrorMatcher, stages ...Stage) + func (p *Pipeline) Output(ctx context.Context) ([]byte, error) + func (p *Pipeline) Run(ctx context.Context) error + func (p *Pipeline) Start(ctx context.Context) error + func (p *Pipeline) Wait() error + type Scanner interface + Bytes func() []byte + Err func() error + Scan func() bool + type Stage interface + Name func() string + Requirements func() StageRequirements + Start func(ctx context.Context, opts StageOptions, stdin *InputStream, ...) error + Wait func() error + func Command(command string, args ...string) Stage + func CommandStage(name string, cmd *exec.Cmd) Stage + func FilterError(s Stage, filter ErrorFilter) Stage + func Function(name string, f StageFunc, opts ...FunctionOption) Stage + func IgnoreError(s Stage, em ErrorMatcher) Stage + func LinewiseFunction(name string, f LinewiseStageFunc) Stage + func Print(a ...interface{}) Stage + func Printf(format string, a ...interface{}) Stage + func Println(a ...interface{}) Stage + func ScannerFunction(name string, newScanner NewScannerFunc, f LinewiseStageFunc) Stage + func WithExtraEnv(inner Stage, env []EnvVar) Stage + type StageFunc func(ctx context.Context, env Env, stdin io.Reader, stdout io.Writer) error + type StageOptions struct + PanicHandler StagePanicHandler + type StagePanicHandler func(p any) error + type StageRequirements struct + Stdin StreamRequirement + Stdout StreamRequirement + type StreamRequirement int + const StreamAcceptAny + const StreamForbidden + const StreamPreferFile + func (requirement StreamRequirement) Validate() error Other modules containing this package github.com/github/go-pipe