#!/usr/bin/env python # Test case simulating all of the calls made by portage # for https://bugs.gentoo.org/show_bug.cgi?id=459674 import fcntl import os import sys BUFSIZE = 4096 TEST_STRING = "." * BUFSIZE stdout_fd = os.dup(sys.stdout.fileno()) fcntl.fcntl(stdout_fd, fcntl.F_SETFL, fcntl.fcntl(stdout_fd, fcntl.F_GETFL) | fcntl.FD_CLOEXEC) while True: stdout_buf = TEST_STRING while stdout_buf: stdout_buf = stdout_buf[os.write(stdout_fd, stdout_buf):]