packer/background_check.go
Adrien Delorme 27d89ac8d4
update all plugins + pin go to go 1.17 (#11237)
* up plugins and get rid of a dependency loop from packer to packer
2021-09-02 12:15:13 +02:00

23 lines
433 B
Go

//go:build !openbsd
// +build !openbsd
package main
import (
"fmt"
"github.com/shirou/gopsutil/process"
)
func checkProcess(currentPID int) (bool, error) {
myProc, err := process.NewProcess(int32(currentPID))
if err != nil {
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)
}
return bg, nil
}