diff --git a/dmoj/executors/base_executor.py b/dmoj/executors/base_executor.py index e9c13b907..c9549fd7f 100644 --- a/dmoj/executors/base_executor.py +++ b/dmoj/executors/base_executor.py @@ -6,7 +6,6 @@ import sys import tempfile import traceback -from distutils.spawn import find_executable from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union from dmoj.cptbox import IsolateTracer, TracedPopen, syscalls @@ -413,7 +412,7 @@ def find_command_from_list(cls, files: List[str]) -> Optional[str]: if os.path.exists(file): return file else: - path = find_executable(file) + path = shutil.which(file) if path is not None: return os.path.abspath(path) return None diff --git a/dmoj/executors/shell_executor.py b/dmoj/executors/shell_executor.py index 62344ee04..11b6f4b08 100644 --- a/dmoj/executors/shell_executor.py +++ b/dmoj/executors/shell_executor.py @@ -1,6 +1,6 @@ import os +import shutil import sys -from distutils.spawn import find_executable from dmoj.executors.script_executor import ScriptExecutor @@ -13,7 +13,7 @@ def get_shell_commands(self): return self.shell_commands def get_allowed_exec(self): - return list(map(find_executable, self.get_shell_commands())) + return list(map(shutil.which, self.get_shell_commands())) def get_fs(self): return super().get_fs() + self.get_allowed_exec()