Repository navigation
s2c: return failure for stdin-to-stdout stream errors - #1328
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Merged #239 - PTAL. |
|
@perfloop-agent ptal at conflicts |
|
@klauspost Sorry for the delay. We're having some hiccups. Kicking it manually. |
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
db0015a to
cbaf290
Compare
|
Rebased onto master. #1297 rewrote the stdin block, so the fix is now one line: the stdout branch calls |
s2c -has returned success after stdin read or stdout write errors since #239: with nonempty input,s2c - < in > /dev/fullexits 0 after reporting a write error. This change returns status 2 after either streaming step fails, while retaining the existing diagnostics.(1) Save the error from closing the writer and check it alongside the read/compression error after both have been reported. The writer is still closed before exiting, so both diagnostics are reported as before.
TestStdinins2/cmd/s2c/main_test.goruns the command in child processes. It covers failed stdin reads, failed stdout writes during compression, a write failure during close, and a successful stream that decodes to its original input. The close-only case uses empty input with padding so the failure cannot occur during reading.The four
TestStdinsubtests (success,write,close,read) passed in both the default andnoasmGo test builds, with no failures or skips.This applies to stdin-to-stdout streaming only; stdin-to-file (
-o) handling is unchanged.Related work: open PR #1297 also adds
s2/cmd/s2c/main_test.goand edits the same lines ofs2/cmd/s2c/main.go, so the two conflict. If it lands first, this change can be rebased onto it.Case and evidence
Made by Perfloop. Human sponsor: Tomás Senart.
Summary by CodeRabbit
s2ccommand now exits with status 2 if reading input or closing the output fails. Failures when writing to standard output continue to result in status 2.