Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tool_writeout: refactor write-out and write-out json #6544

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/cmdline-opts/write-out.d
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The Content-Type of the requested document, if there was any.
The error message. (Added in 7.75.0)
.TP
.B exitcode
The numerical exitcode. (Added in 7.75.0)
The numerical exitcode of the transfer. (Added in 7.75.0)
.TP
.B filename_effective
The ultimate filename that curl writes out to. This is only meaningful if curl
Expand Down
7 changes: 4 additions & 3 deletions src/tool_operate.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,9 +625,6 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
newline here */
fputs("\n", per->progressbar.out);

if(config->writeout)
ourWriteOut(per->curl, per, config->writeout, result);

/* Close the outs file */
if(outs->fopened && outs->stream) {
int rc = fclose(outs->stream);
Expand All @@ -647,6 +644,10 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
setfiletime(filetime, outs->filename, global);
}

/* Write the --write-out data before cleanup but after result is final */
if(config->writeout)
ourWriteOut(config->writeout, per, result);

/* Close function-local opened file descriptors */
if(per->heads.fopened && per->heads.stream)
fclose(per->heads.stream);
Expand Down
Loading