Fixed bug with using pypy

This commit is contained in:
Boyan 2024-12-04 02:46:20 +01:00
parent 5af72b4f99
commit b9d2589f8b

View File

@ -13,7 +13,7 @@ def check_dependencies() -> None:
for command in commands:
if os.system(f"which {command} > /dev/null") != 0:
print(f"{Fore.RED}Error: {command} not found{Style.RESET_ALL}")
print(f"{Fore.ORANGE}WARNING: {command} not found{Style.RESET_ALL}")
return
@ -123,13 +123,14 @@ def run_input_cases(program, args):
def python_compile(file_name, args):
try:
if subprocess.run(["which", "pypy3"]).returncode == 0:
if os.system("which pypy3 > /dev/null") == 0:
print(f"{Fore.LIGHTMAGENTA_EX}Using pypy3{Style.RESET_ALL}")
run_input_cases("pypy3 " + file_name, args)
return
except Exception:
pass
finally:
run_input_cases("python3 " + file_name, args)
print(f"{Fore.MAGENTA}WARNING: pypy3 not found, using python3 instead{Style.RESET_ALL}")
run_input_cases("python3 " + file_name, args)
return