From e8c830f5cedc2918f1a3e7f38087d580d4d78daf Mon Sep 17 00:00:00 2001 From: potatoe <48511543+manthanabc@users.noreply.github.com> Date: Sun, 26 Jan 2025 10:42:21 +0000 Subject: [PATCH] [Fix] clear buffer before reading again (#280) --- swhkd/src/daemon.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/swhkd/src/daemon.rs b/swhkd/src/daemon.rs index 8a5af76..1a98d9c 100644 --- a/swhkd/src/daemon.rs +++ b/swhkd/src/daemon.rs @@ -701,6 +701,9 @@ pub fn refresh_env( log::error!("Failed to write to socket."); return Ok((None, prev_hash)); } + + // Clear the buffer before reading + buff.clear(); stream.read_to_string(&mut buff)?; }