def readall(fd):
    """read until EOF"""
    from os import read
    result = b''
    while True:
        try:
            chunk = read(fd, 1 << 10)
        except __HOLE__ as error:
            if error.errno == 5:  # linux pty EOF
                return result
            else:
                raise
        if chunk == '':
            return result
        else:
            result += chunk
dataset/ETHPy150Open Yelp/dumb-init/tests/tty_test.py/readall