Documentation ¶
Overview ¶
Package process holds a Transport implementation that runs local, unsandboxed processes
Index ¶
- type Config
- type ProcessTransport
- func (p *ProcessTransport) GetHumanStatus() string
- func (p *ProcessTransport) GetStatus() util.TransportStatus
- func (p *ProcessTransport) IsRunning() bool
- func (p *ProcessTransport) Run(start chan struct{}) (exitCode int, exitString string, exitError error)
- func (p *ProcessTransport) Stderr() <-chan []byte
- func (p *ProcessTransport) Stdout() <-chan []byte
- func (p *ProcessTransport) StopOrKill() error
- func (p *ProcessTransport) StopOrKillTimeout(duration time.Duration) error
- func (p *ProcessTransport) StopOrKillWaitgroup(group *sync.WaitGroup)
- func (p *ProcessTransport) Update(rawConf tomlconf.ConfigHolder) error
- func (p *ProcessTransport) Write(b []byte) (n int, err error)
- func (p *ProcessTransport) WriteString(s string) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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) WriteString ¶
func (p *ProcessTransport) WriteString(s string) (n int, err error)
WriteString writes the given string to the process's stdin