process

package
v1.7.0-dev-20191004 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2019 License: Apache-2.0 Imports: 9 Imported by: 21

Documentation

Overview

Package process has helper code for managing server processes and connections to them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartOnDevice added in v1.2.0

func StartOnDevice(ctx context.Context, name string, opts StartOptions) (int, error)

StartOnDevice runs the application on the given remote device, with the given path and options, waits for the "Bound on port {port}" string to be printed to stdout, and then returns the port number.

Types

type PortWatcher added in v1.2.0

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

PortWatcher will wait for the given port to become available on the given device. It will look at the given stdout, for the lines Bound on port <portnum>, and in the given portFile for the same lines. If either is found, the port will be written to portChan. Otherwise an error will be written to the channel.

func NewPortWatcher added in v1.2.0

func NewPortWatcher(portChan chan<- string, opts *StartOptions) *PortWatcher

NewPortWatcher creates and returns an initialized port watcher

func (*PortWatcher) WaitForFile added in v1.2.0

func (w *PortWatcher) WaitForFile(ctx context.Context)

Waits until the port file is found, or the context is cancelled

func (*PortWatcher) Write added in v1.2.0

func (w *PortWatcher) Write(b []byte) (n int, err error)

type StartOptions

type StartOptions struct {
	// Command line arguments for starting the process.
	Args []string

	// Environment variables for starting the process.
	Env *shell.Env

	// Standard output pipe for the new process.
	Stdout io.Writer

	// Standard error pipe for the new process.
	Stderr io.Writer

	// Should all stderr and and stdout also be logged to the logger?
	Verbose bool

	// PortFile, if not "", is a file that can be search if we can
	// not find the output on stdout
	PortFile string

	// If not "", the working directory for this command
	WorkingDir string

	// IgnorePort, if true, then will not wait for the port to become
	// available
	IgnorePort bool

	// Device, which device should this be started on
	Device bind.Device
}

StartOptions holds the options that can be passed to Start.

Jump to

Keyboard shortcuts

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