From b0057d187348cb13709f77ba26a20817f7e83dd8 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 6 Jul 2026 13:33:26 +0000 Subject: [PATCH] test/rpc: fix file handle leak in status fd reader Use 'with' statement instead of manual open/read/close to ensure the file is closed if read() raises an exception. Assisted-by: Claude Code (claude-opus-4-6) Signed-off-by: Adrian Reber --- test/others/rpc/read.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/others/rpc/read.py b/test/others/rpc/read.py index ff7e5c1a0..eb9d4d70a 100755 --- a/test/others/rpc/read.py +++ b/test/others/rpc/read.py @@ -7,9 +7,8 @@ import sys -f = open(sys.argv[1]) -r = f.read(1) -f.close() +with open(sys.argv[1]) as f: + r = f.read(1) if r == '\0': sys.exit(0)