Skip to content

Commit ae22fef

Browse files
dschoGit for Windows Build Agent
authored andcommitted
Merge pull request #2111 from gitgitgadget/jk/no-sigpipe-during-network-transport
Fix t5570 flakiness on macOS
2 parents db729df + 5245fbb commit ae22fef

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

builtin/fetch.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,7 +1556,9 @@ static int fetch_one(struct remote *remote, int argc, const char **argv, int pru
15561556

15571557
sigchain_push_common(unlock_pack_on_signal);
15581558
atexit(unlock_pack);
1559+
sigchain_push(SIGPIPE, SIG_IGN);
15591560
exit_code = do_fetch(gtransport, &rs);
1561+
sigchain_pop(SIGPIPE);
15601562
refspec_clear(&rs);
15611563
transport_disconnect(gtransport);
15621564
gtransport = NULL;

fetch-pack.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,10 @@ static void send_request(struct fetch_pack_args *args,
191191
if (args->stateless_rpc) {
192192
send_sideband(fd, -1, buf->buf, buf->len, LARGE_PACKET_MAX);
193193
packet_flush(fd);
194-
} else
195-
write_or_die(fd, buf->buf, buf->len);
194+
} else {
195+
if (write_in_full(fd, buf->buf, buf->len) < 0)
196+
die_errno(_("unable to write to remote"));
197+
}
196198
}
197199

198200
static void insert_one_alternate_object(struct fetch_negotiator *negotiator,
@@ -1165,7 +1167,8 @@ static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
11651167

11661168
/* Send request */
11671169
packet_buf_flush(&req_buf);
1168-
write_or_die(fd_out, req_buf.buf, req_buf.len);
1170+
if (write_in_full(fd_out, req_buf.buf, req_buf.len) < 0)
1171+
die_errno(_("unable to write request to remote"));
11691172

11701173
strbuf_release(&req_buf);
11711174
return ret;

pkt-line.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,15 @@ static void packet_trace(const char *buf, unsigned int len, int write)
8888
void packet_flush(int fd)
8989
{
9090
packet_trace("0000", 4, 1);
91-
write_or_die(fd, "0000", 4);
91+
if (write_in_full(fd, "0000", 4) < 0)
92+
die_errno(_("unable to write flush packet"));
9293
}
9394

9495
void packet_delim(int fd)
9596
{
9697
packet_trace("0001", 4, 1);
97-
write_or_die(fd, "0001", 4);
98+
if (write_in_full(fd, "0001", 4) < 0)
99+
die_errno(_("unable to write delim packet"));
98100
}
99101

100102
int packet_flush_gently(int fd)

0 commit comments

Comments
 (0)