0

I am running these two commands in a CI pipeline:

go run . &                       # Start a local server on port 8080
curl localhost:8080 > result.yml # Save the response to a file

Current result: I get the error curl: (7) Failed to connect to localhost port 8080 after 0 ms: Connection refused

Needed result: curl waits for x seconds until it returns this error.

I have tried the options --connect-timeout and --max-time (Source), but they don't do what I need.

Is there a CLI option for that, or do I have to write a shell script?

Neskews
  • 652
  • 1
  • 9
  • 22
  • 2
    curl retry mechanism https://stackoverflow.com/a/42873372/2834978. Try: `time curl -4 --connect-timeout 5 --retry 3 --retry-connrefused http://localhost:2081` – LMC May 30 '22 at 15:40

0 Answers0