Skip to content

Commit c6d3cce

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 14eab81 commit c6d3cce

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

run-command.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,8 @@ static int pump_io_round(struct io_pump *slots, int nr, struct pollfd *pfd)
13771377
io->u.out.len <= MAX_IO_SIZE ?
13781378
io->u.out.len : MAX_IO_SIZE);
13791379
if (len < 0) {
1380-
if (errno != EINTR && errno != EAGAIN) {
1380+
if (errno != EINTR && errno != EAGAIN &&
1381+
errno != ENOSPC) {
13811382
io->error = errno;
13821383
close(io->fd);
13831384
io->fd = -1;

0 commit comments

Comments
 (0)