From bce6a84723a69fa6cb3f1ce6574bc8e2685f772b Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 6 Aug 2026 17:58:02 +0000 Subject: [PATCH] test(log): exercise foreign fd-capture sentinel in reader path Child stop() is a no-op off the owner pid, so the existing fork test never wrote a PID-tagged sentinel. Inject one after waitpid so _reader_loop's foreign-sentinel drop path is covered. Co-authored-by: Andrew Aikawa --- tests/test_fd_capture.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_fd_capture.py b/tests/test_fd_capture.py index 1dbc692..7176331 100644 --- a/tests/test_fd_capture.py +++ b/tests/test_fd_capture.py @@ -168,6 +168,8 @@ def test_child_stop_does_not_mute_parent(self): def test_child_stop_leaks_no_control_bytes(self): """A foreign sentinel is swallowed, not teed or logged as output.""" + from pluto import _fd_capture as fc + with capture_fd(2, logging.ERROR) as (cap, sm): pid = os.fork() if pid == 0: @@ -176,6 +178,10 @@ def test_child_stop_leaks_no_control_bytes(self): finally: os._exit(0) os.waitpid(pid, 0) + # Child stop() is a no-op off the owner pid, so it never writes a + # sentinel. Inject a foreign PID-tagged mark to exercise the + # reader path that must drop it without muting capture. + os.write(2, fc._stop_sentinel(pid)) time.sleep(0.3) os.write(2, b'still here\n')