2019-09-18 13:51:57 -04:00
|
|
|
// +build !openbsd
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2019-09-19 11:55:52 -04:00
|
|
|
"fmt"
|
|
|
|
|
2019-09-18 13:51:57 -04:00
|
|
|
"github.com/shirou/gopsutil/process"
|
|
|
|
)
|
|
|
|
|
|
|
|
func checkProcess(currentPID int) (bool, error) {
|
2019-09-19 11:55:52 -04:00
|
|
|
myProc, err := process.NewProcess(int32(currentPID))
|
|
|
|
if err != nil {
|
2019-09-19 11:57:50 -04:00
|
|
|
return false, fmt.Errorf("Process check error: %s", err)
|
|
|
|
}
|
|
|
|
bg, err := myProc.Background()
|
|
|
|
if err != nil {
|
|
|
|
return bg, fmt.Errorf("Process background check error: %s", err)
|
2019-09-19 11:55:52 -04:00
|
|
|
}
|
2019-09-18 13:51:57 -04:00
|
|
|
|
|
|
|
return bg, nil
|
|
|
|
}
|