summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2021-10-29 22:34:16 +1100
committerMaxime Coste <mawww@kakoune.org>2021-10-29 22:34:19 +1100
commitd2e2caaae6119b5abc2aca3a95e2da7db547eac3 (patch)
tree93b0c2187f455451234434d2b6385a9ddf742b74 /src
parentbe4659097c06b3353961cef309448e2cf572cd9a (diff)
Fix incorrect reading logic and EAGAIN handling
This is one of the issues raised by #4410
Diffstat (limited to 'src')
-rw-r--r--src/shell_manager.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/shell_manager.cc b/src/shell_manager.cc
index b3605609..bd101633 100644
--- a/src/shell_manager.cc
+++ b/src/shell_manager.cc
@@ -176,9 +176,12 @@ FDWatcher make_reader(int fd, String& contents, OnClose&& on_close)
char buffer[1024];
while (fd_readable(fd))
{
- size_t size = ::read(fd, buffer, sizeof(buffer));
+ ssize_t size = ::read(fd, buffer, sizeof(buffer));
if (size <= 0)
{
+ if (size < 0 and errno == EAGAIN)
+ continue; // try again
+
watcher.disable();
on_close();
return;