Re: [PATCH v2] receive-pack: add option to interrupt pre-receive when client exits
- From
- Robin Jarry <robin.jarry@6wind.com>
- Date
- Jan 27, 2022, 08:38 UTC
- Message-ID
- <CHGBKD7TF1S5.3VUMATFQPY9TE@diabtop>
- In-Reply-To
- <CANYiYbGME-=w4raiwW3w1_gHzVpsvdStz7xVpKqAwx2r_Vezzw@mail.gmail.com>
Jiang Xin, Jan 27, 2022 at 04:21:
Show 5 quoted lines
> Can we use a flag instead of hook_pid to distinguish the source of the > SIGPIPE signal? > 1. "pre-receive" hook exits early without consuming stdin. > 2. "pre-receive" hook hangs after receiving commands from stdin, until > client quits by receiving a "ctrl-c".
Also there is:
3. the client has exited and receive-pack got SIGPIPE while forwarding pre-receive output in the socket.
I don't think we can differentiate from these three situations from the receive-pack point of view.
However, using a flag in the signal handler to note that SIGPIPE was received (for whatever reason) may be better than my current implementation.
Show 5 quoted lines
> Can we let the signal handler in "pre-receive" to do it job? And we
> can show some user friendly error message here. E.g.:
>
> die("broken pipe: seems like the pre-receive hook exits early
> without consuming its stdin");If that flag is set after pre-receive has exited, we can indeed:
die("broken pipe: ...").Of course, if 3. the error message will never reach the client.