runner

package
v1.8.8 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2018 License: MIT Imports: 21 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeginWatch

func BeginWatch(dirConfig *home.EdwardConfiguration, service services.ServiceOrGroup, restart func() error, logger Logger) (func(), error)

BeginWatch starts auto-restart watches for the provided services. The function returned will close the watcher.

func WaitUntilLive added in v1.8.8

func WaitUntilLive(dirConfig *home.EdwardConfiguration, pid int32, service *services.ServiceConfig) error

WaitUntilLive blocks until a command running the specified service is in the RUNNING state. An error will be returned if the command exits before reaching RUNNING.

Types

type Log

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

Log provides the io.Writer interface to publish service logs to file

func (*Log) Len added in v1.8.8

func (r *Log) Len() int

func (*Log) Printf

func (r *Log) Printf(format string, a ...interface{})

Printf prints a message to a RunnerLog

func (*Log) Write

func (r *Log) Write(p []byte) (int, error)

Write writes a slice of bytes to a RunnerLog

type LogLine

type LogLine struct {
	Name    string
	Time    time.Time
	Stream  string
	Message string
}

LogLine represents a line in an Edward service log

func ParseLogLine

func ParseLogLine(line string) (LogLine, error)

ParseLogLine parses the JSON representation of a log line into a LogLine

type Logger

type Logger interface {
	Printf(format string, a ...interface{})
}

Logger provides a simple interface for logging

type Runner

type Runner struct {
	Service   *services.ServiceConfig
	DirConfig *home.EdwardConfiguration

	NoWatch    bool
	WorkingDir string

	Logger Logger
	// contains filtered or unexported fields
}

Runner provides state and functions for running a given service

func (*Runner) Messagef

func (r *Runner) Messagef(format string, a ...interface{})

func (*Runner) Run

func (r *Runner) Run(args []string) error

type RunningCommand

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

RunningCommand provides state and functions for running a service

func NewRunningCommand

func NewRunningCommand(service *services.ServiceConfig, cmd *exec.Cmd, commandWait *sync.WaitGroup) *RunningCommand

NewRunningCommand creates a RunningCommand for a given service and exec.Cmd

func (*RunningCommand) Interrupt

func (c *RunningCommand) Interrupt() error

Interrupt sends an interrupt to a running command

func (*RunningCommand) Kill

func (c *RunningCommand) Kill() error

Kill sends a kill signal to a running command

func (*RunningCommand) Pid added in v1.8.8

func (c *RunningCommand) Pid() int

Pid returns the process id for the running command

func (*RunningCommand) Start

func (c *RunningCommand) Start(errorLog Logger)

Start starts a command running in a goroutine. Will block until the service has started running and has a PID.

func (*RunningCommand) Wait

func (c *RunningCommand) Wait()

Wait blocks until this command has exited

Jump to

Keyboard shortcuts

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