Move duplicated processExists function to shared util package: - Create internal/util/process.go with ProcessExists function - Add internal/util/process_test.go with basic tests - Update witness/manager.go to use util.ProcessExists - Update refinery/manager.go to use util.ProcessExists - Remove local processExists functions from both files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
14 lines
311 B
Go
14 lines
311 B
Go
package util
|
|
|
|
import "os"
|
|
|
|
// ProcessExists checks if a process with the given PID exists.
|
|
// It uses the Unix convention of sending signal 0 to test for process existence.
|
|
func ProcessExists(pid int) bool {
|
|
proc, err := os.FindProcess(pid)
|
|
if err != nil {
|
|
return false
|
|
}
|
|
return proc.Signal(nil) == nil
|
|
}
|