check for and handle errors

This commit is contained in:
Megan Marsh 2019-09-19 08:55:52 -07:00
parent 622be96fa0
commit aa8b9164a3
1 changed files with 6 additions and 1 deletions

View File

@ -3,11 +3,16 @@
package main
import (
"fmt"
"github.com/shirou/gopsutil/process"
)
func checkProcess(currentPID int) (bool, error) {
myProc, _ := process.NewProcess(int32(currentPID))
myProc, err := process.NewProcess(int32(currentPID))
if err != nil {
return false, fmt.Errorf("Error figuring out Packer process info")
}
bg, _ := myProc.Background()
return bg, nil