Documentation
¶
Overview ¶
Package process Provide some process handle util functions
Index ¶
- func Exists(pid int) bool
- func ExistsByName(name string, fuzzyMatch bool) bool
- func Kill(pid int, signal syscall.Signal) error
- func KillByName(keywords string, sig syscall.Signal) error
- func PID() int
- func PIDByName(keywords string) int
- func ProcInfo(pid int) (*os.Process, error)
- func Start(name string, argv []string, attr *os.ProcAttr) (*os.Process, error)
- func StopByName(name string, option ...*StopProcessOption) (bool, string, error)
- type PidFile
- type StopProcessOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExistsByName ¶ added in v0.6.18
ExistsByName check process running by given name
func KillByName ¶ added in v0.6.2
KillByName kill process by name match
func ProcInfo ¶ added in v0.6.2
ProcInfo looks for a running process by its pid.
alias of os.FindProcess()
func Start ¶ added in v0.6.2
Start starts a new process with the program, arguments and attributes specified by name, argv and attr.
alias of os.StartProcess()
func StopByName ¶ added in v0.6.18
func StopByName(name string, option ...*StopProcessOption) (bool, string, error)
StopByName Stop process based on process name.
return (exists, output, error). check error to see if the process exists
Usage:
StopByName("MyApp.exe")
Types ¶
type PidFile ¶ added in v0.5.6
type PidFile struct {
// contains filtered or unexported fields
}
PidFile struct
type StopProcessOption ¶ added in v0.6.18
type StopProcessOption struct {
// Check if the process exists before stopping it
CheckExist bool
// Whether to force exit the process
ForceKill bool
// Whether to wait for the process to exit
WaitExit bool
// How long to wait for the process to exit
ExitTimeout int
// Signal to send to the process(non-win)
Signal syscall.Signal
}
StopProcessOption stop process option
Click to show internal directories.
Click to hide internal directories.