code: func (p *Process) wait() error {
  	ticker := time.NewTicker(1000 * time.Millisecond)
  	defer ticker.Stop()
  
  	timer := time.NewTimer(30 * time.Second)
  	defer ticker.Stop()
  
  	for {
  		select {
  		case <-timer.C:
  			return errors.New("timeout")
  		case <-ticker.C:
  			if err := p.ping(); err == nil {
  				return nil
  			}
  		}
  	}
  }
docs: // wait continually checks the process until it gets a response or times out.