From 503e5bc507cd7dc0d425789d01c1c9bfe3277ad9 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 3 Jun 2022 15:54:55 +1000 Subject: [PATCH] Only set fd to non-block if there is an EventManager Fixes #4630 --- src/file.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/file.cc b/src/file.cc index 60210e35e..d38c95633 100644 --- a/src/file.cc +++ b/src/file.cc @@ -258,7 +258,8 @@ void write(int fd, StringView data) ssize_t count = (int)data.length(); int flags = fcntl(fd, F_GETFL, 0); - fcntl(fd, F_SETFL, flags | O_NONBLOCK); + if (EventManager::has_instance()) + fcntl(fd, F_SETFL, flags | O_NONBLOCK); auto restore_flags = on_scope_end([&] { fcntl(fd, F_SETFL, flags); }); while (count)