runner

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Spec   CommandSpec
	Status CommandStatus
}

type CommandSpec

type CommandSpec struct {
	Command string
	Args    []string
}

func Cmd

func Cmd(cmd string, args ...string) CommandSpec

func (*CommandSpec) String

func (c *CommandSpec) String() string

type CommandStatus

type CommandStatus struct {
	Pid     int
	State   ProcessState
	Message string
}

type CooldownError

type CooldownError struct {
	Duration time.Duration
	// contains filtered or unexported fields
}

type Proc

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

func StartProcess

func StartProcess(logger *logrus.Entry, terminationSignal syscall.Signal, terminationGracePeriod time.Duration, cmd CommandSpec) (*Proc, error)

StartProcess starts a process.

func (*Proc) Pid

func (p *Proc) Pid() int

Pid returns the process ID.

func (*Proc) Running

func (p *Proc) Running() bool

Running returns true if the process is still running.

func (*Proc) Signal

func (p *Proc) Signal(sig syscall.Signal) error

Signal sends the given signal to the process.

func (*Proc) Stop

func (p *Proc) Stop()

Stop stops the process.

func (*Proc) Wait

func (p *Proc) Wait() error

Wait waits for the process to terminate.

type ProcessState

type ProcessState string
const (
	ProcessStateRunning ProcessState = "running"
	ProcessStateFailed  ProcessState = "failed"
	ProcessStateExited  ProcessState = "exited"
)

type Runner

type Runner struct {
	Reporter               StatusReportFunc
	TerminationSignal      syscall.Signal
	TerminationGracePeriod time.Duration
	// contains filtered or unexported fields
}

func New

func New(logger *logrus.Entry) *Runner

func (*Runner) SignalReload

func (m *Runner) SignalReload() error

func (*Runner) Start

func (m *Runner) Start(cmd CommandSpec) (started bool, err error)

func (*Runner) Stop

func (m *Runner) Stop()

type StatusReportFunc

type StatusReportFunc func(cmd Command)

Jump to

Keyboard shortcuts

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