Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocalProcess ¶
type LocalProcess struct {
// contains filtered or unexported fields
}
LocalProcess is the implementation of the Process interface.
func (*LocalProcess) QueryStatus ¶
func (l *LocalProcess) QueryStatus(pidfile string) (Status, error)
QueryStatus of the backgrounded process referenced by the PID in the given file.
If the process is not running StatusStopped, and a nil error will be returned. If the process is running StatusRunning, and a nil error will be returned. If it is not possible to query the status of the process or if the pidfile is not readable. StatusError, and an error will be returned.
func (*LocalProcess) Start ¶
func (l *LocalProcess) Start(options Options) (int, string, error)
Start returns the process ID and the pidfile for the running process. If a process can not be started then an error will be returned.
func (*LocalProcess) Stop ¶
func (l *LocalProcess) Stop(pidfile string) error
Stop the process referenced by the PID in the given file.
type Options ¶
type Options struct { // Path of the process to start Path string // Arguments to pass when starting the process Args []string // Environments to pass when starting the process Env []string // Directory to start the process in, default is the current directory Dir string // File to write the running process ID to, if blank a temporary file // will be created. Pidfile string // File to write output from the started command to, if blank logs // will be disgarded Logfile string }
Options to be used when starting a process
type Process ¶
type Process interface { // Start a process in the background Start(options Options) (int, string, error) // Stop the current running process Stop(pidfile string, signal syscall.Signal) error // Return the status of the currently running process QueryStatus(pidfile string) (Status, error) }
Process defines an interface which defines methods for managing a child process.
type Status ¶
type Status string
Status of the process
const StatusError Status = "StatusError"
StatusError is returned when it is not possible to determine the status of a process
const StatusRunning Status = "StatusRunning"
StatusRunning is returned when the process is Running
const StatusStopped Status = "StatusStopped"
StatusStopped is returned when the process is Stopped