runner

package
v0.0.0-...-521d647 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2017 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeginWatch

func BeginWatch(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.

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

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 Nedward 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

	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

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

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