process

package module
v0.0.0-...-f204007 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: MIT Imports: 9 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLog

func NewLog(path string) *os.File

Create a new file for logging

func WithArgs

func WithArgs(s ...string) func(cfg *Config) error

func WithKillSignal

func WithKillSignal(s string) func(cfg *Config) error

WithKillSignal sets the given signal while attemping to stop. Defaults to "9"

func WithName

func WithName(s string) func(cfg *Config) error

func WithSTDIN

func WithSTDIN(f *os.File) func(cfg *Config) error

func WithStateDir

func WithStateDir(s string) func(cfg *Config) error

func WithTemporaryStateDir

func WithTemporaryStateDir() func(cfg *Config) error

Types

type Config

type Config struct {
	Name        string
	Args        []string
	Combined    bool
	StateDir    string
	KillSignal  string
	Environment []string
	Stdin       *os.File
}

func DefaultConfig

func DefaultConfig() *Config

func (*Config) Apply

func (cfg *Config) Apply(opts ...Option) error

Apply applies the given options to the config, returning the first error encountered (if any).

type Option

type Option func(cfg *Config) error

func WithEnvironment

func WithEnvironment(s ...string) Option

type Process

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

func New

func New(p ...Option) *Process

New builds up a new process with options

func (*Process) ExitCode

func (p *Process) ExitCode() (string, error)

ExitCode returns the exitcode associated with the process

func (*Process) IsAlive

func (p *Process) IsAlive() bool

IsAlive checks if the process is running or not

func (*Process) Run

func (p *Process) Run() error

Run starts the process and returns any error

func (*Process) StateDir

func (p *Process) StateDir() string

StateDir returns the process state directory

func (*Process) StderrPath

func (p *Process) StderrPath() string

StderrPath returns the file where the stderr of the process is appended to

func (*Process) StdoutPath

func (p *Process) StdoutPath() string

StdoutPath returns the file where the stdout is appended to

func (*Process) Stop

func (p *Process) Stop() error

Stop stops the running process by senging KillSignal to the PID annotated in the pidfile

Jump to

Keyboard shortcuts

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