process

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KILL_EXEC = "KILL_STALE"
View Source
var KILL_STALE = Execute{
	Cmd:  "KILL_STALE",
	Type: "blocking",
}
View Source
var REFRESH_EXEC = "REFRESH"

Functions

This section is empty.

Types

type Execute

type Execute struct {
	Cmd       string `toml:"cmd"        yaml:"cmd"`        // Execute command
	ChangeDir string `toml:"dir"        yaml:"dir"`        // If directory needs to be changed to call this command relative to the root path
	DelayNext int    `toml:"delay_next" yaml:"delay_next"` // Delay in milliseconds before running command
	// Type can have one of a few types to define how it reacts to a file change
	// background -- runs once at startup and is killed when refresh is canceled
	// once -- runs once at refresh startup but is blocking
	// blocking -- runs every refresh cycle as a blocking process
	// primary -- Is the primary process that kills the previous processes before running
	Type ExecuteType `toml:"type"       yaml:"type"`
}

type ExecuteType added in v0.8.0

type ExecuteType string
var (
	Background ExecuteType = "background"
	Once       ExecuteType = "once"
	Blocking   ExecuteType = "blocking"
	Primary    ExecuteType = "primary"
)

type Process

type Process struct {
	Exec string
	Type ExecuteType
	Dir  string
	// contains filtered or unexported fields
}

type ProcessManager

type ProcessManager struct {
	Processes []*Process
	RootDir   string

	Ctxs     map[string]context.Context
	Cancels  map[string]context.CancelFunc
	FirstRun bool
	// contains filtered or unexported fields
}

func NewProcessManager

func NewProcessManager() *ProcessManager

func (*ProcessManager) AddProcess

func (pm *ProcessManager) AddProcess(exec string, typing string, dir string) error

func (*ProcessManager) ChangeExecuteDirectory added in v0.8.0

func (pm *ProcessManager) ChangeExecuteDirectory(dir string) error

func (*ProcessManager) GetExecutes

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

func (*ProcessManager) KillProcesses

func (pm *ProcessManager) KillProcesses()

func (*ProcessManager) RestoreRootDirectory added in v0.8.0

func (pm *ProcessManager) RestoreRootDirectory() error

func (*ProcessManager) SetRootDirectory added in v0.8.0

func (pm *ProcessManager) SetRootDirectory(dir string) error

func (*ProcessManager) StartProcess

func (pm *ProcessManager) StartProcess(ctx context.Context, cancel context.CancelFunc)

Jump to

Keyboard shortcuts

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