title: Wait until a condition is met or timeout
body: <p>I'm trying to write a function that break when a condition is met the output of command is equal something (hello in this example) in this case or 
  timeout is reached </p>
  
  <pre><code>timeout := 10 sec
  
  func run() error {
  
  for {
  
      out , _ := exec.Command("echo", "hello").Output()
      if string(out) == "hello" || timeout  {
          break
      }
  }
  
  }
  </code></pre>
  
  <p>I've seen that folks use select but I don't know how to use it here, 
  any hints? </p>