def read_until_close(self, encoding: str | None = "utf-8") -> Union[str, bytes]:
        """
        read until connection close
        :param encoding: default utf-8, if pass None, return bytes
        """
        content = b""
        while True:
            chunk = self.read(4096)
            if not chunk:
                break
            content += chunk
        return content.decode(encoding, errors='replace') if encoding else content

        read until connection close
        :param encoding: default utf-8, if pass None, return bytes
        
adbutils/_adb.py