Documentation
¶
Overview ¶
Package app provides extended facilities for gathering information about the executing application.
Index ¶
- Constants
- Variables
- func CreatePidFile() (int, error)
- func DeletePidFile() error
- func GetExeDir() string
- func GetExeFile() string
- func GetExePath() string
- func GetName() string
- func GetPidBaseDir() string
- func GetRunStatus() *os.Process
- func ReadAsPidFile(path string) (int, error)
- func ReadPidFile() (int, error)
- func SetPidBaseDir(path string)
Constants ¶
const NoPid = -1
NoPid is returned during any pid operations which fail to aquire a valid pid.
Variables ¶
var PidParseErr = errors.New("Unable to parse pid file")
Module errors
Functions ¶
func CreatePidFile ¶
CreatePidFile creates the calling application's pid file and returns the application's current pid for reference.
func DeletePidFile ¶
func DeletePidFile() error
DeletePidFile attempts to remove the caller application's pid file (if any) and returns any errors from the underlying os.Remove call.
func GetExeDir ¶
func GetExeDir() string
GetExeDir returns the base directory of the executing binary.
func GetExeFile ¶
func GetExeFile() string
GetExeFile returns the file name of the executing binary.
func GetExePath ¶
func GetExePath() string
GetExePath attempts to find and return the executing binary's full path.
func GetName ¶
func GetName() string
GetName returns the name of the executing application, as parsed from the executing binary's file name.
func GetPidBaseDir ¶
func GetPidBaseDir() string
GetPidBaseDir reads the base directory for pid operations in a thread-safe way.
func GetRunStatus ¶
GetRunStatus attempts to read the application pid file and check the status of the given pid. It will return the active process, if one exists, or nil if there is no pid file, or the documented pid is no longer active. If a pid file is found, but the pid is no longer active, GetRunStatus will automatically attempt to clean up the lingering pid file.
func ReadAsPidFile ¶
ReadAsPidFile attempts to read and parse a given file path as a pid file, returning the pid recorded within the given file.
func ReadPidFile ¶
ReadPidFile calls ReadAsPidFile using the calling application's pid file path.
func SetPidBaseDir ¶
func SetPidBaseDir(path string)
SetPidBaseDir sets the base directory for pid operations in a thread-safe way.
Types ¶
This section is empty.