From 3f20939d2606c41181cdba4ac399357830367ce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Fri, 25 Sep 2026 18:07:11 +0300 Subject: [PATCH] update: end the kept answer with a newline Co-authored-by: Claude Opus 5.5 (1M context) --- src/update.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/update.rs b/src/update.rs index eeccd3e..df11f1a 100644 --- a/src/update.rs +++ b/src/update.rs @@ -91,8 +91,10 @@ impl Answer { /// Replaces the kept answer through a renamed temporary file, so a reader /// never sees half of it. pub fn write(&self, directory: &Path) -> io::Result<()> { - // Serialize the answer and make sure the cache directory exists - let bytes = serde_json::to_vec(self).map_err(io::Error::other)?; + // Serialize the answer as one line ending in a newline, and make sure + // the cache directory exists + let mut bytes = serde_json::to_vec(self).map_err(io::Error::other)?; + bytes.push(b'\n'); fs::create_dir_all(directory)?; // Rename only a completely written file over the kept answer