diff options
authorJeff King <>2022-08-17 06:09:42 (GMT)
committerJunio C Hamano <>2022-08-17 16:21:41 (GMT)
commitc6d3cce6f3c4d1a8d9ebc556c38f1335afdfeb6c (patch)
parent14eab817e499cb047dd8ba21e688257a06d043f0 (diff)
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 <> Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
1 files changed, 2 insertions, 1 deletions
diff --git a/run-command.c b/run-command.c
index e078c30..5fbaa8b 100644
--- a/run-command.c
+++ b/run-command.c
@@ -1377,7 +1377,8 @@ static int pump_io_round(struct io_pump *slots, int nr, struct pollfd *pfd)
io->u.out.len <= MAX_IO_SIZE ?
io->u.out.len : MAX_IO_SIZE);
if (len < 0) {
- if (errno != EINTR && errno != EAGAIN) {
+ if (errno != EINTR && errno != EAGAIN &&
+ errno != ENOSPC) {
io->error = errno;
io->fd = -1;