utils

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStalePidfile = errors.New("stale pidfile detected")
)

Functions

func CheckPidfile

func CheckPidfile(pidFilename string) (bool, error)

CheckPidfile reads a PID from the specified file and verifies if a process with that PID is running. Returns os.ErrNotExist if the pidfile does not exist, otherwise returns an error wrapped in utils.ErrCheckPidfile if an error occurred during the check or utils.ErrStalePidfile if the PID file is stale.

func ObservableCloseHandler

func ObservableCloseHandler(name string, log zerolog.Logger) func()

func ObservableErrorHandler

func ObservableErrorHandler(name string, log zerolog.Logger) func(error)

func TrimWithEllipsis

func TrimWithEllipsis(toTrim string, trimLength int) string

TrimWithEllipsis trims a string if it is longer than trimLength and appends an ellipsis if the string was trimmed

Types

type ErrCheckPidfile

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

func (ErrCheckPidfile) Error

func (e ErrCheckPidfile) Error() string

func (ErrCheckPidfile) Unwrap

func (e ErrCheckPidfile) Unwrap() error

Jump to

Keyboard shortcuts

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