mirror of
https://github.com/curl/curl.git
synced 2025-02-11 14:50:40 +08:00
curl: make -w's %{stderr} use the file set with --stderr
Reported-by: u20221022 on github Fixes #10491 Closes #10569
This commit is contained in:
parent
80b7f05baf
commit
d9b7f6e750
@ -661,7 +661,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
|
||||
|
||||
/* Write the --write-out data before cleanup but after result is final */
|
||||
if(config->writeout)
|
||||
ourWriteOut(config->writeout, per, result);
|
||||
ourWriteOut(config, per, result);
|
||||
|
||||
/* Close function-local opened file descriptors */
|
||||
if(per->heads.fopened && per->heads.stream)
|
||||
|
@ -376,15 +376,19 @@ static int writeOffset(FILE *stream, const struct writeoutvar *wovar,
|
||||
return 1; /* return 1 if anything was written */
|
||||
}
|
||||
|
||||
void ourWriteOut(const char *writeinfo, struct per_transfer *per,
|
||||
void ourWriteOut(struct OperationConfig *config, struct per_transfer *per,
|
||||
CURLcode per_result)
|
||||
{
|
||||
FILE *stream = stdout;
|
||||
const char *writeinfo = config->writeout;
|
||||
const char *ptr = writeinfo;
|
||||
bool done = FALSE;
|
||||
struct curl_certinfo *certinfo;
|
||||
CURLcode res = curl_easy_getinfo(per->curl, CURLINFO_CERTINFO, &certinfo);
|
||||
|
||||
if(!writeinfo)
|
||||
return;
|
||||
|
||||
if(!res && certinfo)
|
||||
per->certinfo = certinfo;
|
||||
|
||||
@ -423,7 +427,7 @@ void ourWriteOut(const char *writeinfo, struct per_transfer *per,
|
||||
stream = stdout;
|
||||
break;
|
||||
case VAR_STDERR:
|
||||
stream = stderr;
|
||||
stream = config->global->errors;
|
||||
break;
|
||||
case VAR_JSON:
|
||||
ourWriteOutJSON(stream, variables, per, per_result);
|
||||
|
@ -84,7 +84,7 @@ struct writeoutvar {
|
||||
bool use_json);
|
||||
};
|
||||
|
||||
void ourWriteOut(const char *writeinfo, struct per_transfer *per,
|
||||
void ourWriteOut(struct OperationConfig *config, struct per_transfer *per,
|
||||
CURLcode per_result);
|
||||
|
||||
#endif /* HEADER_CURL_TOOL_WRITEOUT_H */
|
||||
|
Loading…
Reference in New Issue
Block a user