Skip to content

Commit

Permalink
Merge branch 'sp/smart-http-failure-to-push' into maint
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Junio C Hamano committed Mar 5, 2012
2 parents 26f1e9b + c34fe63 commit a4d7615
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions transport-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "remote.h"
#include "string-list.h"
#include "thread-utils.h"
#include "sigchain.h"

static int debug;

Expand Down Expand Up @@ -220,15 +221,21 @@ static struct child_process *get_helper(struct transport *transport)
static int disconnect_helper(struct transport *transport)
{
struct helper_data *data = transport->data;
struct strbuf buf = STRBUF_INIT;
int res = 0;

if (data->helper) {
if (debug)
fprintf(stderr, "Debug: Disconnecting.\n");
if (!data->no_disconnect_req) {
strbuf_addf(&buf, "\n");
sendline(data, &buf);
/*
* Ignore write errors; there's nothing we can do,
* since we're about to close the pipe anyway. And the
* most likely error is EPIPE due to the helper dying
* to report an error itself.
*/
sigchain_push(SIGPIPE, SIG_IGN);
xwrite(data->helper->in, "\n", 1);
sigchain_pop(SIGPIPE);
}
close(data->helper->in);
close(data->helper->out);
Expand Down

0 comments on commit a4d7615

Please sign in to comment.