Summary
The shared output helpers do not propagate serialization, write, flush, or close failures. Some paths print a success message after an ignored failure.
Source references (current main):
For example, PrintOutput can fail to write the requested output path and still return normally. OutputJSONL prints that output was written even if a later write or close failed.
Why this matters
Failures caused by disk exhaustion, permissions, a broken pipe, filesystem errors, or unsupported values can result in missing or truncated exports with exit status 0. A caller may delete its source data or advance a checkpoint based on a success message even though the output is unusable.
Close errors matter for files because buffered or delayed filesystem failures can first surface during close.
Expected behavior
Output functions should return errors, and command RunE handlers should propagate them so the CLI exits non-zero. Success output should only be emitted after all writes and the final close complete successfully.
Suggested tests
- Inject a writer that fails after a partial write.
- Attempt output to an invalid/unwritable path.
- Assert that close failures and JSON marshal failures reach the command caller.
- Assert that no success message is printed following a failed export.
Summary
The shared output helpers do not propagate serialization, write, flush, or close failures. Some paths print a success message after an ignored failure.
Source references (current
main):OutputJSONprints marshal errors and returns no errorOutputJSONLignores marshal, write, separator, and close errorsPrintOutputignores both JSON marshaling andos.WriteFilefailuresFor example,
PrintOutputcan fail to write the requested output path and still return normally.OutputJSONLprints that output was written even if a later write or close failed.Why this matters
Failures caused by disk exhaustion, permissions, a broken pipe, filesystem errors, or unsupported values can result in missing or truncated exports with exit status 0. A caller may delete its source data or advance a checkpoint based on a success message even though the output is unusable.
Close errors matter for files because buffered or delayed filesystem failures can first surface during close.
Expected behavior
Output functions should return errors, and command
RunEhandlers should propagate them so the CLI exits non-zero. Success output should only be emitted after all writes and the final close complete successfully.Suggested tests