Help us shape the future of Go! Take the 2026 Go Developer Survey

commons

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package commons provides shared command-line process helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintVersion

func PrintVersion(command *cobra.Command) error

func ProcessCommonFlags

func ProcessCommonFlags(command *cobra.Command) (*commons.Config, error)

func ProcessRunning

func ProcessRunning(pid int) bool

ProcessRunning reports whether a process exists or cannot be inspected due to insufficient permission.

func ReadPID

func ReadPID(path string) (int, error)

ReadPID reads and validates a PID from a PID file.

func SetCommonFlags

func SetCommonFlags(command *cobra.Command)

func SignalPID

func SignalPID(pid int, signal syscall.Signal) error

SignalPID sends a signal to a process and reports stale PID files clearly.

Types

type PIDFile

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

PIDFile holds an exclusive lock on a process ID file.

func AcquirePIDFile

func AcquirePIDFile(path string) (*PIDFile, error)

AcquirePIDFile creates and exclusively locks a PID file for this process.

func (*PIDFile) Close

func (p *PIDFile) Close() error

Close removes the owned PID file and releases its lock.

Jump to

Keyboard shortcuts

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