import subprocess

CONTAINER_ID = "637a559cbf1d"
AVAP_BIN = "/opt/AVAP_Language_Server/avap.bin"

def run_avap_file(avap_file_in_container: str):
    cmd = [
        "docker",
        "exec",
        CONTAINER_ID,
        "sh",
        "-lc",
        f'{AVAP_BIN} "{avap_file_in_container}"'
    ]

    result = subprocess.run(
        cmd,
        capture_output=True,
        text=True
    )

    return result

result = run_avap_file("/opt/AVAP_Language_Server/sample/hello_world.avap")

print("Return code:", result.returncode)
print("STDOUT:")
print(result.stdout)
print("STDERR:")
print(result.stderr)
print("RAW OUTPUT:")
print(repr(result.stdout))
print(result.stdout.splitlines())