app

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

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

Go to latest
Published: Sep 30, 2019 License: BSD-2-Clause Imports: 10 Imported by: 4

README

App

Build Status

Build Status

Overview

App is a Go package which provides some additional capability for gathering information about the executing application.

License

This Go package is release under a BSD-style license, the contents of which are in the repo's LICENSE file.

API Documentation

http://godoc.org/github.com/xaevman/app

Documentation

Overview

Package app provides extended facilities for gathering information about the executing application.

Index

Constants

View Source
const NoPid = -1

NoPid is returned during any pid operations which fail to aquire a valid pid.

Variables

View Source
var PidParseErr = errors.New("Unable to parse pid file")

Module errors

Functions

func CreatePidFile

func CreatePidFile() (int, error)

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

func GetRunStatus() *os.Process

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

func ReadAsPidFile(path string) (int, error)

ReadAsPidFile attempts to read and parse a given file path as a pid file, returning the pid recorded within the given file.

func ReadPidFile

func ReadPidFile() (int, error)

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.

Jump to

Keyboard shortcuts

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