INNER CODE UNIT · Go
waitForTcpOrExit
kubernetes/dns · cmd/sidecar-e2e/main.go:116
func waitForTcpOrExit(cmd *exec.Cmd, endpoint string) error {
exitChan := make(chan error)
go func() {
_, err := cmd.Process.Wait()
exitChan <- err
}()
return waitForPredicate(
func() (bool, error) {
// Check to see that the process has not died early.
select {
case err := <-exitChan:
return true, fmt.Errorf("process died: %v", err)
default:
}
conn, err := net.Dial("tcp", endpoint)
if err == nil {