Documentation
¶
Index ¶
- func CheckProcess(processName string, insensitive bool) (bool, error)
- func GetPidByName(name string) string
- func KillProcess(pid int) error
- func KillProcessByName(name string) error
- func KillProcessByName2(name string)
- func KillProcessImpl(process *os.Process) error
- func ProcessInfo(pid int32) (string, error)
- type Process
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPidByName ¶
func KillProcess ¶
func KillProcessByName ¶
func KillProcessByName2 ¶
func KillProcessByName2(name string)
func KillProcessImpl ¶
SIGINT与SIGTERM区别 1)SIGINT关联ctrl+c 2)SIGINT只能结束前台进程 3)通过ctrl+c对当前进程发送结束信号,信号被进程树接收到(即:不仅当前进程,子进程也会收到结束信号) SIGTERM与SIGKILL 1)SIGTERM可以被阻塞、处理和忽略;因此有的进程不能按预期的结束 2)kill不使用参数:发送SIGTERM信号,只有当前进程收到信号,若当前进程被kill,则子进程的父进程就会更改为init,即pid为1 3)kill命令的默认不带参数发生的信号就是SIGTERM,让程序友好的退出 ,当程序未退出时,可以使用kill -9强制退出
func ProcessInfo ¶
Types ¶
type Process ¶
type Process struct {
Pid int
// PPid is the parent process ID for this process.
PPid int
// Executable name running this process. This is not a path to the
// executable.
Executable string
// windows wmi process name
Name string
}
func GetProcesses ¶
func ListProcess ¶
func ListProcess2 ¶
Click to show internal directories.
Click to hide internal directories.