title: How to wait for the command to finish/ till some seconds in golang?
body: <p>I am running command <code>exec.Command(&quot;cf api https://something.com/&quot;) </code> and the response takes sometimes. But when executing this command, there is no wait happens but executed and goes further immediately. I need to wait for some seconds or until output has been received. How to achieve this?</p>
  <pre><code>func TestCMDExex(t *testing.T) {
      expectedText := &quot;Success&quot;
      cmd := exec.Command(&quot;cf api https://something.com/&quot;)
      cmd.Dir = &quot;/root//&quot;
      out, err := cmd.Output()
      if err != nil {
          t.Fail()
      }
      assert.Contains(t, string(out), expectedText)
  
  }
  
  </code></pre>