From 6ef5924725812f5885880cf57821fe2cd49b808d Mon Sep 17 00:00:00 2001 From: Nicolas Lacasse Date: Mon, 1 Jun 2020 14:54:09 -0700 Subject: Deflake pty_test_linux. PiperOrigin-RevId: 314208973 --- test/syscalls/linux/pty.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/syscalls/linux') diff --git a/test/syscalls/linux/pty.cc b/test/syscalls/linux/pty.cc index b8a0159ba..aabfa6955 100644 --- a/test/syscalls/linux/pty.cc +++ b/test/syscalls/linux/pty.cc @@ -364,6 +364,12 @@ PosixErrorOr PollAndReadFd(int fd, void* buf, size_t count, ssize_t n = ReadFd(fd, static_cast(buf) + completed, count - completed); if (n < 0) { + if (errno == EAGAIN) { + // Linux sometimes returns EAGAIN from this read, despite the fact that + // poll returned success. Let's just do what do as we are told and try + // again. + continue; + } return PosixError(errno, "read failed"); } completed += n; -- cgit v1.2.3