Skip to content

Commit a4d7615

Browse files
committed
Merge branch 'sp/smart-http-failure-to-push' into maint
* sp/smart-http-failure-to-push: : Mask SIGPIPE on the command channel going to a transport helper disconnect from remote helpers more gently Conflicts: transport-helper.c
2 parents 26f1e9b + c34fe63 commit a4d7615

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

transport-helper.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "remote.h"
1010
#include "string-list.h"
1111
#include "thread-utils.h"
12+
#include "sigchain.h"
1213

1314
static int debug;
1415

@@ -220,15 +221,21 @@ static struct child_process *get_helper(struct transport *transport)
220221
static int disconnect_helper(struct transport *transport)
221222
{
222223
struct helper_data *data = transport->data;
223-
struct strbuf buf = STRBUF_INIT;
224224
int res = 0;
225225

226226
if (data->helper) {
227227
if (debug)
228228
fprintf(stderr, "Debug: Disconnecting.\n");
229229
if (!data->no_disconnect_req) {
230-
strbuf_addf(&buf, "\n");
231-
sendline(data, &buf);
230+
/*
231+
* Ignore write errors; there's nothing we can do,
232+
* since we're about to close the pipe anyway. And the
233+
* most likely error is EPIPE due to the helper dying
234+
* to report an error itself.
235+
*/
236+
sigchain_push(SIGPIPE, SIG_IGN);
237+
xwrite(data->helper->in, "\n", 1);
238+
sigchain_pop(SIGPIPE);
232239
}
233240
close(data->helper->in);
234241
close(data->helper->out);

0 commit comments

Comments
 (0)