commit 6a76b2a232c7a2636e9b2060bee394f867a760b8 from: Caleb Stein date: Wed May 13 09:30:06 2026 UTC ensure pipe is drained after reading commit - a1c232cd01d5cdefe98b5cc36304114a6874fb3b commit + 6a76b2a232c7a2636e9b2060bee394f867a760b8 blob - d4e8a40971cdef4fdb032ef56e0a43a25a977ec9 blob + 79ed4eb381c97f07cb9e77ed8c6882740d9ea545 --- modules/weather.c +++ modules/weather.c @@ -3,6 +3,7 @@ #include #include +#include #include #include "statbar.h" @@ -44,6 +45,8 @@ read_weather(int fd) { ssize_t n = read(fd, weather_string, sizeof(weather_string)); char *lnbrk; + char garbage[1024]; + int flags = fcntl(fd, F_GETFL, 0); if (n < 0) { @@ -53,6 +56,9 @@ read_weather(int fd) } lnbrk = strchr(weather_string, '\n'); if (lnbrk) *lnbrk = '\0'; + (void)fcntl(fd, F_SETFL, flags | O_NONBLOCK); + while (read(fd, garbage, sizeof(garbage)) > 0); + (void)fcntl(fd, F_SETFL, flags); } void