diff --git a/src/file.cc b/src/file.cc index 60210e35..d38c9563 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)