Commit b64f7a3
committed
fix(hooks): materialize proxied hook stdin into a temp file
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.1 parent a5b51cd commit b64f7a3
1 file changed
Lines changed: 32 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
67 | 92 | | |
68 | 93 | | |
69 | 94 | | |
| |||
102 | 127 | | |
103 | 128 | | |
104 | 129 | | |
| 130 | + | |
| 131 | + | |
105 | 132 | | |
106 | 133 | | |
107 | 134 | | |
| |||
110 | 137 | | |
111 | 138 | | |
112 | 139 | | |
113 | | - | |
| 140 | + | |
114 | 141 | | |
115 | 142 | | |
116 | 143 | | |
| |||
157 | 184 | | |
158 | 185 | | |
159 | 186 | | |
160 | | - | |
| 187 | + | |
161 | 188 | | |
162 | 189 | | |
| 190 | + | |
| 191 | + | |
163 | 192 | | |
164 | 193 | | |
165 | 194 | | |
| |||
0 commit comments