Merge pull request #9432 from UiPath/fix-clh-wait

clh: isClhRunning waits for full timeout when clh exits
This commit is contained in:
Dan Mihai 2024-04-23 13:02:45 -07:00 committed by GitHub
commit 89c85dfe84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1467,7 +1467,12 @@ func (clh *cloudHypervisor) isClhRunning(timeout uint) (bool, error) {
timeStart := time.Now()
cl := clh.client()
for {
err := syscall.Kill(pid, syscall.Signal(0))
waitedPid, err := syscall.Wait4(pid, nil, syscall.WNOHANG, nil)
if waitedPid == pid && err == nil {
return false, nil
}
err = syscall.Kill(pid, syscall.Signal(0))
if err != nil {
return false, nil
}