def read_stdout(proc, lines):
    """ Reads all remaining stdout """
    if proc and proc.stdout:
        while True:
            line = proc.stdout.readline()
            if not line and proc.poll() is not None:
                return
            lines.append(line)
    return None
