Update requirements.txt to adjust package versions; enhance C++ code execution timeout and compilation options in code_utils.py

This commit is contained in:
2025-03-15 17:35:09 +07:00
parent f3bd85fa67
commit c0c20dbdaf
2 changed files with 3 additions and 3 deletions

View File

@@ -514,7 +514,7 @@ async def execute_code(code: str, language: str, timeout: int = 10, input_data:
['g++', '--version'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
timeout=2
timeout=10
))
if check_result.returncode != 0:
@@ -525,10 +525,10 @@ async def execute_code(code: str, language: str, timeout: int = 10, input_data:
# Compile C++ code with restricted options and optimizations
compile_result = await run_in_thread_pool(lambda: subprocess.run(
['g++', src_path, '-o', exe_path, '-std=c++17', '-O2'],
['g++', src_path, '-o', exe_path, '-march=native', '-std=c++17', '-O2'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
timeout=5
timeout=10
))
if compile_result.returncode != 0: