fix: make the closed-pipe test meet a full pipe

This commit is contained in:
Abdessamad Derraz committed 2026-10-18 08:23:38 +02:00
1 parent 7310f9ad54
commit ebf44d523b
1 file changed
+9
+9
View File
@@ -3839,6 +3839,15 @@ class AReaderThatLeavesEarlyIsNoCrash(unittest.TestCase):
[sys.executable, "scripts/verify.py", "--list-emulators"], cwd=ROOT,
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
)
# The listing fits a 64 KiB pipe: a child that wrote it all before
# the close below never met the broken pipe and exited 0. A 4 KiB
# pipe keeps it writing when the reader leaves.
try:
import fcntl # noqa: PLC0415
fcntl.fcntl(proc.stdout.fileno(), fcntl.F_SETPIPE_SZ, 4096)
except (ImportError, AttributeError, OSError):
pass
proc.stdout.readline()
proc.stdout.close()
_, err = proc.communicate(timeout=120)