From ec951dbfa60a9a831230d2e80b451e4f7700c124 Mon Sep 17 00:00:00 2001 From: cfdaily Date: Sun, 17 May 2026 06:32:52 +0800 Subject: [PATCH] auto-sync: 2026-05-17 06:32:52 --- src/daemon/inbox.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/daemon/inbox.py b/src/daemon/inbox.py index 249da12..f76d9ca 100644 --- a/src/daemon/inbox.py +++ b/src/daemon/inbox.py @@ -168,8 +168,8 @@ class InboxWatcher: def _truncate(self) -> None: """清空文件内容(不删除文件)""" try: - with open(self.inbox_path, "w", encoding="utf-8") as f: - f.truncate(0) + with open(self.inbox_path, "w", encoding="utf-8"): + pass # "w" mode already truncates except OSError: logger.exception("Failed to truncate inbox: %s", self.inbox_path)