code: func (n *ExecNode) waitForStartupJSON(ctx context.Context) (string, chan nodeStartupJSON) {
  	var (
  		ch       = make(chan nodeStartupJSON, 1)
  		quitOnce sync.Once
  		srv      http.Server
  	)
  	l, err := net.Listen("tcp", "127.0.0.1:0")
  	if err != nil {
  		ch <- nodeStartupJSON{Err: err.Error()}
  		return "", ch
  	}
  	quit := func(status nodeStartupJSON) {
  		quitOnce.Do(func() {
  			l.Close()
  			ch <- status
  		})
  	}
  	srv.Handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
  		var status nodeStartupJSON
  		if err := json.NewDecoder(r.Body).Decode(&status); err != nil {
  			status.Err = fmt.Sprintf("can't decode startup report: %v", err)
  		}
  		quit(status)
  	})
  	// Run the HTTP server, but don't wait forever and shut it down
  	// if the context is canceled.
  	go srv.Serve(l)
  	go func() {
  		<-ctx.Done()
  		quit(nodeStartupJSON{Err: "didn't get startup report"})
  	}()
  
  	url := "http://" + l.Addr().String()
  	return url, ch
  }
docs: // waitForStartupJSON runs a one-shot HTTP server to receive a startup report.