pipe_command(): handle ENOSPC when writing to a pipe

When write() to a non-blocking pipe fails because the buffer is full, POSIX says we should see EAGAIN. But our mingw_write() compat layer on Windows actually returns ENOSPC for this case. This is probably something we want to correct, but given that we don't plan to use non-blocking descriptors in a lot of places, we can work around it by just catching ENOSPC alongside EAGAIN. If we ever do fix mingw_write(), then this patch can be reverted. We don't actually use a non-blocking pipe yet, so this is still just preparation. Helped-by: René Scharfe <l.s.r@web.de> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Aug 17, 2022 at 02:09 UTC c6d3cce6f3c4d1a8d9ebc556c38f1335afdfeb6c
1 file changed +2 -1
run-command.c
+2 -1
@@ -1377,7 +1377,8 @@ static int pump_io_round(struct io_pump *slots, int nr, struct pollfd *pfd)
1377 io->u.out.len <= MAX_IO_SIZE ?
1378 io->u.out.len : MAX_IO_SIZE);
1379 if (len < 0) {
1380 - if (errno != EINTR && errno != EAGAIN) {
1380 + if (errno != EINTR && errno != EAGAIN &&
1381 + errno != ENOSPC) {
1382 io->error = errno;
1383 close(io->fd);
1384 io->fd = -1;