Only set fd to non-block if there is an EventManager

Fixes #4630
This commit is contained in:
Maxime Coste 2022-06-03 15:54:55 +10:00
parent ac6f928ad4
commit 503e5bc507

View File

@ -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)