command

package
v0.0.0-...-a884e7f Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(cmd string) bool

func ExistsForUser

func ExistsForUser(cmd, user string) bool

func ForUser

func ForUser(cmd *exec.Cmd, userName string) error

func GetHome

func GetHome(userName string) (string, error)

func IsRunning

func IsRunning(pid string) (bool, error)

func Kill

func Kill(pid string) error

func Quote

func Quote(args []string) string

func StartBackgroundOnce

func StartBackgroundOnce(commandName string, createCommand CreateCommand) error

StartBackgroundOnce starts a background process, ensuring only one instance with the given commandName runs at a time. If a process is already running (determined by PID file), or the lock cannot be acquired, it returns nil.

Process output is redirected to TMPDIR/commandName.streams unless the command already has Stdout/Stderr configured. The PID is recorded in TMPDIR/commandName.pid. These files are not cleaned up on exit.

func WrapCommandError

func WrapCommandError(stdout []byte, err error) error

Types

type CreateCommand

type CreateCommand func() (*exec.Cmd, error)

type Error

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

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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