zexec

package
v0.0.0-...-8c08148 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package zexec runs external commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Readlines

func Readlines(cmd *exec.Cmd) (<-chan Output, error)

Readlines calls cmd.Start sends every line of output on the returned channel.

Example usage:

cmd := exec.Command("long-running-process")
ch, err := zexec.Readlines(cmd)

for {
	line, ok := <-ch
	if !ok {
		break
	}
	if line.Error != nil {
		fmt.Fprintln(os.Stderr, "error reading:", line.Error)
		break
	}

	fmt.Println(line)
}

Types

type Output

type Output struct {
	Text   string // Read text, excluding the end delimiter.
	Stderr bool   // Text was sent on stderr.

	// Errors reading the process stdout/stderr; sent only once, and will stop
	// reading after an error.
	Error error
}

func (Output) String

func (o Output) String() string

Jump to

Keyboard shortcuts

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