task

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPrefixer

func NewPrefixer(out io.Writer, prefix string) io.Writer

Types

type Process

type Process struct {
	Task
	// contains filtered or unexported fields
}

func NewProcess

func NewProcess(t Task, padding int) *Process

func (*Process) Done

func (p *Process) Done() bool

func (*Process) Kill

func (p *Process) Kill()

func (*Process) Start

func (p *Process) Start()

func (*Process) Stop

func (p *Process) Stop()

func (*Process) Wait

func (p *Process) Wait() bool

type ProcessRunner

type ProcessRunner interface {
	Start()
	Stop()
	Kill()
	Done() bool
	Wait() bool
}

type ProcessState

type ProcessState int
const (
	ProcessStateIdle ProcessState = iota
	ProcessStateStarting
	ProcessStateRunning
	ProcessStateStopping
	ProcessStateKilling
	ProcessStateRestarting
	ProcessStateExited
)

type ProcessWatcher

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

func NewProcessWatcher

func NewProcessWatcher(t Task, padding int) *ProcessWatcher

func (*ProcessWatcher) Done

func (w *ProcessWatcher) Done() bool

func (*ProcessWatcher) Kill

func (w *ProcessWatcher) Kill()

func (*ProcessWatcher) Start

func (w *ProcessWatcher) Start()

func (*ProcessWatcher) Stop

func (w *ProcessWatcher) Stop()

func (*ProcessWatcher) Wait

func (w *ProcessWatcher) Wait() bool

type Runner

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

func NewRunner

func NewRunner(tasks []Task) *Runner

func (*Runner) Run

func (r *Runner) Run(ctx context.Context) error

func (*Runner) Stop

func (r *Runner) Stop()

type Task

type Task struct {
	// Name used in logs
	Name string

	// Command is the primary command to run.
	Command string

	// WatchFiles will cause the process to restart if any if the files change (can be patterns).
	WatchFiles []string

	// OneShot indicates that the process should run and then exit.
	//
	// Useful for running tests.
	OneShot bool
}

func Parse

func Parse(r io.Reader) ([]Task, error)

type Watcher

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

func Watch

func Watch(patterns []string) *Watcher

func (*Watcher) Changed

func (w *Watcher) Changed() bool

Jump to

Keyboard shortcuts

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