Skip to content

fix(git): report why cat-file failed, not the broken pipe to it - #36

Merged
ChmaraX merged 1 commit into
mainfrom
fix/cat-file-broken-pipe
Nov 14, 2026
Merged

ChmaraX merged 1 commit into
mainfrom
fix/cat-file-broken-pipe

Conversation

@ChmaraX

@ChmaraX ChmaraX commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Problem

When gitview reads files from another machine and the connection drops, the person should see "machine … is unreachable". Instead they sometimes see Broken pipe (os error 32). gitview sends the paths it wants to git cat-file through its input. If the remote command has already exited (hc lost the connection), that write fails, and ? returned the pipe error before gitview read the command's exit status and stderr.

The same race makes a_diff_whose_reads_fail_there_is_an_error_not_a_wrong_diff fail on CI now and then. It failed on #30 and #35, and on main after #35 merged.

Fix

cat_file keeps the write's result, waits for git, and reports git's own failure first. A write error is still an error when git exits successfully.

Proof

To force the race, I put a temporary 300 ms pause before the write, so the remote command always exits first (not committed):

  • main + pause: the test fails every time with {"error":"Broken pipe (os error 32)"}
  • this branch + pause: the test passes, with the "unreachable" error

On Rust 1.100: cargo fmt --check, cargo clippy --all-targets -- -D warnings and cargo test pass.

@ChmaraX
ChmaraX merged commit 815346b into main Nov 14, 2026
2 checks passed
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.

1 participant