processmgr

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package processmgr manages processes launched by avash

Index

Constants

This section is empty.

Variables

View Source
var ProcManager = ProcessManager{
	// contains filtered or unexported fields
}

ProcManager is a global

Functions

This section is empty.

Types

type InputHandler

type InputHandler func(p []byte) (bool, error)

InputHandler is a generic function for handling input from cin

type OutputHandler

type OutputHandler func(b bytes.Buffer) error

OutputHandler recieves the information

type Process

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

Process declares the necessary data for tracking a process

func (*Process) Kill

func (p *Process) Kill() error

Kill ends a process with SIGTERM

func (*Process) Start

func (p *Process) Start(done chan bool)

Start begins a new process

func (*Process) Stop

func (p *Process) Stop() error

Stop ends a process with SIGINT

type ProcessManager

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

ProcessManager is a system for managing processes in the system

func (*ProcessManager) AddProcess

func (pm *ProcessManager) AddProcess(cmdstr string, proctype string, args []string, name string, metadata string, ih InputHandler, oh OutputHandler, eh OutputHandler) error

AddProcess places a process into the process manager with an associated name

func (*ProcessManager) HasRunning

func (pm *ProcessManager) HasRunning() bool

HasRunning returns true if there exists a running process, otherwise false

func (*ProcessManager) KillAllProcesses

func (pm *ProcessManager) KillAllProcesses()

KillAllProcesses calls Kill() on every running process, logging errors

func (*ProcessManager) KillProcess

func (pm *ProcessManager) KillProcess(name string) error

KillProcess kills the process at the name

func (*ProcessManager) Metadata

func (pm *ProcessManager) Metadata(name string) (string, error)

Metadata returns the metadata given the process name

func (*ProcessManager) ProcessSummary

func (pm *ProcessManager) ProcessSummary() *[][]string

ProcessSummary returns data table of all processes and their statuses

func (*ProcessManager) ProcessTable

func (pm *ProcessManager) ProcessTable(table *tablewriter.Table) *tablewriter.Table

ProcessTable returns a formatted metadata table for the data provided

func (*ProcessManager) RemoveAllProcesses

func (pm *ProcessManager) RemoveAllProcesses()

RemoveAllProcesses removes a process from the list of available named processes

func (*ProcessManager) RemoveProcess

func (pm *ProcessManager) RemoveProcess(name string) error

RemoveProcess removes a process from the list of available named processes

func (*ProcessManager) StartAllProcesses

func (pm *ProcessManager) StartAllProcesses()

StartAllProcesses calls Start() on every stopped process, logging errors

func (*ProcessManager) StartProcess

func (pm *ProcessManager) StartProcess(name string) error

StartProcess starts the process at the name

func (*ProcessManager) StopAllProcesses

func (pm *ProcessManager) StopAllProcesses()

StopAllProcesses calls Stop() on every running process, logging errors

func (*ProcessManager) StopProcess

func (pm *ProcessManager) StopProcess(name string) error

StopProcess stops the process at the name

Jump to

Keyboard shortcuts

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