curl / Mailing Lists / curl-users / Single Mail


Re: Easily find the exit code of curl

From: Dave Reisner <>
Date: Sat, 27 Apr 2019 20:37:41 -0400

On Sat, Apr 27, 2019 at 06:13:04PM +0000, Jon Harris wrote:
> I am looking for an easy way to find the exit code of a curl process that was running in the background. A logical place would be one of the variables available through --write-out but that doesn't appear to exist. Could this be added?
> Related, how about an option for --write-out to go to a file instead of stdout or stderr. That makes it possible to isolate this info from other possibly useful output.
> Any suggestions for a work-around? I thought about parsing through the various outputs I can get from curl, but that seems difficult. I also want to get at other information such as the normal stdout, stderr and sometimes the --trace-ascii.

I assume this is related to your other post where you're in control of
the child process for curl. The answer seems to be the same -- get the
exit status when you call wait/waitpid to reap the child.

Received on 2019-04-28