Skip to content

Commit

Permalink
stdio: ignore EIO for terminals
Browse files Browse the repository at this point in the history
when the terminal is closed, we get EIO.  Let's treat it as a EOF.

Closes: #440

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe authored and haircommander committed Aug 14, 2023
1 parent 77ce312 commit 53b3691
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ctr_stdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ static bool read_stdio(int fd, stdpipe_t pipe, gboolean *eof)
*eof = true;
return false;
} else if (num_read < 0) {
/* Ignore EIO if fd is a tty, since this can happen when the tty is closed
while we are reading from it. */
if (errno == EIO && isatty(fd)) {
if (eof)
*eof = true;
return false;
}
nwarnf("stdio_input read failed %s", strerror(errno));
return false;
} else {
Expand Down

0 comments on commit 53b3691

Please sign in to comment.