process

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package process holds a Transport implementation that runs local, unsandboxed processes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	util.BaseConfig
}

Config is the process transports config

type ProcessTransport

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

ProcessTransport is a transport implementation that works with a process.Process to provide local-to-us game servers

func New

func New(transportConfig tomlconf.ConfigHolder, logger *log.Logger) (*ProcessTransport, error)

New creates a new ProcessTransport for use with a process

func (*ProcessTransport) GetHumanStatus

func (p *ProcessTransport) GetHumanStatus() string

GetHumanStatus returns the status of the transport that is human readable

func (*ProcessTransport) GetStatus

func (p *ProcessTransport) GetStatus() util.TransportStatus

GetStatus returns the current state of the game the transport manages

func (*ProcessTransport) IsRunning

func (p *ProcessTransport) IsRunning() bool

IsRunning returns whether or not the process is currently running

func (*ProcessTransport) Run

func (p *ProcessTransport) Run(start chan struct{}) (exitCode int, exitString string, exitError error)

Run runs the process once, if it is not already running. It blocks until the process exits

func (*ProcessTransport) Stderr

func (p *ProcessTransport) Stderr() <-chan []byte

Stderr returns a channel that will have lines from stderr sent over it

func (*ProcessTransport) Stdout

func (p *ProcessTransport) Stdout() <-chan []byte

Stdout returns a channel that will have lines from stdout sent over it.

func (*ProcessTransport) StopOrKill

func (p *ProcessTransport) StopOrKill() error

StopOrKill attempts to stop the process with SIGINT, and after 30 seconds stops it with SIGKILL

func (*ProcessTransport) StopOrKillTimeout

func (p *ProcessTransport) StopOrKillTimeout(duration time.Duration) error

StopOrKillTimeout is like StopOrKill, but allows you to specify the timeout

func (*ProcessTransport) StopOrKillWaitgroup

func (p *ProcessTransport) StopOrKillWaitgroup(group *sync.WaitGroup)

StopOrKillWaitgroup calls StopOrKill, and marks a waitgroup as Done once it has completed. The waitgroup is incremented automatically before the StopOrKill call

func (*ProcessTransport) Update

func (p *ProcessTransport) Update(rawConf tomlconf.ConfigHolder) error

Update updates the Transport with a TransportConfig

func (*ProcessTransport) Write

func (p *ProcessTransport) Write(b []byte) (n int, err error)

func (*ProcessTransport) WriteString

func (p *ProcessTransport) WriteString(s string) (n int, err error)

WriteString writes the given string to the process's stdin

Jump to

Keyboard shortcuts

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