Skip to content

CLI: report a failed output write and keep the input - #1537

Merged
copybara-service[bot] merged 3 commits into
google:masterfrom
lenamonj:cli-report-write-failure
Oct 21, 2026
Merged

copybara-service[bot] merged 3 commits into
google:masterfrom
lenamonj:cli-report-write-failure

Conversation

@lenamonj

@lenamonj lenamonj commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

When writing the output failed, brotli --rm still deleted the input and exited 0. CloseFiles never flushed fout itself: the only flush was inside CopyStat, whose failure returns silently, and the unlink of the input ran regardless of is_ok.

CloseFiles now flushes first and reports a failure, skips the metadata copy after one, and unlinks the input only when the output is known complete. CopyStat no longer flushes.

brotli --rm -f -o /dev/full f on master: exit 0, f gone. With this change: exit 1, f kept.

@google-cla

google-cla Bot commented Sep 6, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@lenamonj

lenamonj commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

@googlebot I signed it!

@lenamonj
lenamonj force-pushed the cli-report-write-failure branch from 665583d to cfd59fe Compare September 6, 2026 09:08
@eustas

eustas commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Comment in CopyStat is a bit confusing (because we enter it if there were no failure) and not necessary (explains not doing something we no longer do here). Please drop it. Thanks.

@lenamonj

lenamonj commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

Comment dropped.

@copybara-service
copybara-service Bot merged commit 529bd7a into google:master Oct 21, 2026
57 checks passed
@lenamonj
lenamonj deleted the cli-report-write-failure branch October 21, 2026 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants