You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
packer/background_check.go

27 lines
508 B

// Copyright IBM Corp. 2013, 2025
// SPDX-License-Identifier: BUSL-1.1
//go:build !openbsd
// +build !openbsd
package main
import (
"fmt"
"github.com/shirou/gopsutil/v3/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
}