def METHOD_NAME(proc, stdout, stderr):
    lines = {stdout: [], stderr: []}
    while proc.poll() is None:
        ready, _, _ = select.select([stdout, stderr], [], [])
        for stream in ready:
            line = stream.readline()
            lines[stream].append(line)
            if "-s" in sys.argv or "--capture=no" in sys.argv:
                print(
                    line,
                    end="",
                    file=(sys.stdout if stream == stdout else sys.stderr),
                )
    lines[stdout].extend(stdout.readlines())
    lines[stderr].extend(stderr.readlines())
    return (
        proc.poll(),
        [line for line in lines[stdout] if line.strip() != ""],
        [line for line in lines[stderr] if line.strip() != ""],
    )