Skip to content

formatter: propagate output write errors - #7549

Open
Hoomanghkhani wants to merge 1 commit into
docker:masterfrom
Hoomanghkhani:fix/formatter-output-errors
Open

Hoomanghkhani wants to merge 1 commit into
docker:masterfrom
Hoomanghkhani:fix/formatter-output-errors

Conversation

@Hoomanghkhani

Copy link
Copy Markdown

Fixes #7548

Summary

Return write and flush errors from the common formatter so callers can report incomplete output and exit with a failure status. Render the table header into a buffer first so a custom template that only renders part of the header still produces the same text.

The regression tests exercise JSON, custom text, table writes, and table flushes. The formatter tests and the full ./cli/... Go test suite passed. A built CLI also returned a write error and a nonzero exit status for each docker context ls format with stdout redirected to /dev/full.

Assisted-by: OpenAI Codex (GPT-6).

Release notes

- Report write errors when formatted command output cannot be written.

Return errors from copying formatted rows and flushing the table writer.
Keep the existing partial header output for custom table templates.

Assisted-by: OpenAI Codex (GPT-6)
Signed-off-by: Hooman <hooman.ghkhani@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Formatted commands exit successfully when writing stdout fails

1 participant