fix(hooks): materialize proxied hook stdin into a temp file#108
Merged
pol-rivero merged 2 commits intoMar 27, 2026
Merged
Conversation
f144044 to
44799b9
Compare
Avoid forwarding hook stdin through `/dev/stdin` or `/proc/self/fd/0` when GitHub Desktop Plus runs Git hooks through the process proxy on Linux. - create a temporary FIFO under the system temp directory for Linux hook stdin forwarding instead of relying on fd-backed pseudo-paths that `git hook run` may fail to reopen - start the FIFO writer only after `spawn(...)` succeeds so pre-spawn failures cannot deadlock on a writer waiting for its first reader - attach an immediate handler to the FIFO forward promise so early reader disconnects or aborts cannot surface as unhandled promise rejections - surface unexpected stdin transport failures before reporting hook success, while still treating broken-pipe and abort conditions as expected during teardown - stream the proxy connection stdin into that FIFO so hook stdin behavior stays streaming instead of fully buffering the payload before hook startup - keep non-Linux behavior on `/dev/stdin` unchanged - register the proxy abort handler before stdin forwarding work begins so GUI-side cancellation still propagates during hook setup - wrap the temporary FIFO lifecycle in `try/finally`, abort the writer on early exit, and always clean up the temp directory after hook execution - treat hook completion as authoritative instead of waiting for the FIFO writer to drain, so hooks that stop reading stdin early do not hang the proxy on successful exit Behavioral effect: Hooks that depend on stdin still receive the expected payload, but Linux GUI clients no longer depend on reopening `/dev/stdin` or `/proc/self/fd/0` through the Electron/process-proxy stack.
44799b9 to
b64f7a3
Compare
Owner
|
All your changes are reasonable, and it certainly works as advertised. Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix Linux hook proxy stdin forwarding in GitHub Desktop Plus by replacing fragile fd-backed hook stdin paths with a FIFO-backed handoff that preserves streaming behavior and cleans up correctly across success, failure, and cancellation paths.
Problem
GUI-driven Git operations on Linux could fail before repository hook logic ran normally because the hook proxy passed stdin to
git hook runthrough pseudo-paths that were not reliably reopenable in the Electron/process-proxy environment.Observed failures:
fatal: could not open '/dev/stdin' for reading: No such device or addressfatal: could not open '/proc/self/fd/0' for reading: No such device or addressA naive temp-file buffering approach also introduced its own regressions around stdin semantics, cleanup, and partial-read hooks.
Changes
/dev/stdinor/proc/self/fd/0spawn(...)succeeds so pre-spawn failures cannot deadlock on a writer waiting for its first reader/dev/stdinunchangedtry/finallyand always clean up the temporary directory after hook executionBehavioral effect
Hooks that depend on stdin still receive the expected payload, but Linux GUI clients no longer depend on reopening
/dev/stdinor/proc/self/fd/0through the Electron/process-proxy stack.Verification
/dev/stdinand/proc/self/fd/0could fail in the packaged Desktop hook path even when terminal Git workedyarn eslint app/src/lib/hooks/hooks-proxy.ts