mirror of
https://github.com/status-im/consul.git
synced 2025-03-01 05:40:40 +00:00
This turns out to have a lot more subtelty than we accounted for. The test suite is especially prone to races now we can only poll the child and many extra levels of indirectoin are needed to correctly run daemon process without it becoming a Zombie. I ran this test suite in a loop with parallel enabled to verify for races (-race doesn't find any as they are logical inter-process ones not actual data races). I made it through ~50 runs before hitting an error due to timing which is much better than before. I want to go back and see if we can do better though. Just getting this up.
15 lines
316 B
Go
15 lines
316 B
Go
// +build windows
|
|
|
|
package proxy
|
|
|
|
import (
|
|
"os"
|
|
)
|
|
|
|
func findProcess(pid int) (*os.Process, error) {
|
|
// On Windows, os.FindProcess will error if the process is not alive, so we
|
|
// don't have to do any further checking. The nature of it being non-nil means
|
|
// it seems to be healthy.
|
|
return os.FindProcess(pid)
|
|
}
|