import os import asyncio async def check_file(filepath): proc = await asyncio.create_subprocess_exec( "moon", "run", "src/bin/main.mbt", "--", "--typecheck", filepath, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, ) stdout, stderr = await proc.communicate() if proc.returncode != 0: print(f""" [{proc.returncode}] Error in file {filepath}: ======== STDOUT ======== {stdout.decode()} ======== STDERR ======== {stderr.decode()} """) else: print(f"File {filepath} compiled successfully.") async def main(): tasks = [] for file in os.listdir("contest-2025-data/test_cases/mbt"): if file.endswith(".mbt"): filepath = os.path.join("contest-2025-data/test_cases/mbt", file) tasks.append(check_file(filepath)) await asyncio.gather(*tasks) if __name__ == "__main__": asyncio.run(main())