AI Update: همیشه برای هر پروژه در صورت امکان از php استفاده شود
This commit is contained in:
@@ -33,4 +33,8 @@
|
|||||||
## Mandatory High Effort for Troubleshooting & Diagnostics
|
## Mandatory High Effort for Troubleshooting & Diagnostics
|
||||||
- ALWAYS and for all projects, initial bug analysis, troubleshooting, diagnosis, root-cause analysis, and system investigations MUST be performed with the highest level of reasoning effort (High Effort / High Thinking).
|
- ALWAYS and for all projects, initial bug analysis, troubleshooting, diagnosis, root-cause analysis, and system investigations MUST be performed with the highest level of reasoning effort (High Effort / High Thinking).
|
||||||
|
|
||||||
|
## Preferred Programming Language & Tech Stack (PHP)
|
||||||
|
- ALWAYS use **PHP** (e.g. PHP 8.x, modern PHP, Laravel/Symfony/Slim or standalone PHP scripts/APIs) as the primary/default programming language and technology stack for all projects and backend services whenever feasible and applicable, unless the user explicitly requests another language or the nature of the task strictly requires a different technology.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -507,27 +507,41 @@ class TaskScheduler:
|
|||||||
success = True
|
success = True
|
||||||
|
|
||||||
elif task.task_type == "command":
|
elif task.task_type == "command":
|
||||||
# Run bash command
|
# Run bash command with timeout protection (5 minutes default)
|
||||||
proc = await asyncio.create_subprocess_shell(
|
proc = await asyncio.create_subprocess_shell(
|
||||||
task.content,
|
task.content,
|
||||||
stdout=asyncio.subprocess.PIPE,
|
stdout=asyncio.subprocess.PIPE,
|
||||||
stderr=asyncio.subprocess.PIPE,
|
stderr=asyncio.subprocess.PIPE,
|
||||||
cwd=workspace,
|
cwd=workspace,
|
||||||
|
start_new_session=True,
|
||||||
)
|
)
|
||||||
stdout_b, stderr_b = await proc.communicate()
|
try:
|
||||||
stdout_str = stdout_b.decode("utf-8", errors="replace").strip()
|
stdout_b, stderr_b = await asyncio.wait_for(proc.communicate(), timeout=300.0)
|
||||||
stderr_str = stderr_b.decode("utf-8", errors="replace").strip()
|
stdout_str = stdout_b.decode("utf-8", errors="replace").strip()
|
||||||
|
stderr_str = stderr_b.decode("utf-8", errors="replace").strip()
|
||||||
|
success = (proc.returncode == 0)
|
||||||
|
except asyncio.TimeoutError:
|
||||||
|
try:
|
||||||
|
import signal
|
||||||
|
os.killpg(os.getpgid(proc.pid), signal.SIGKILL)
|
||||||
|
except Exception:
|
||||||
|
try:
|
||||||
|
proc.kill()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
stdout_str = ""
|
||||||
|
stderr_str = "⏱️ مدت زمان اجرای دستور بیش از ۵ دقیقه طول کشید و به دلیل اتمام زمان مجاز (Timeout) متوقف شد." if is_fa else "⏱️ Command execution timed out (>5 minutes) and was automatically terminated."
|
||||||
|
success = False
|
||||||
|
|
||||||
out_parts = []
|
out_parts = []
|
||||||
if stdout_str:
|
if stdout_str:
|
||||||
out_parts.append(f"<b>خروجی استاندارد (stdout):</b>\n<pre>{escape_html(stdout_str[:3000])}</pre>")
|
out_parts.append(f"<b>خروجی استاندارد (stdout):</b>\n<pre>{escape_html(stdout_str[:3000])}</pre>")
|
||||||
if stderr_str:
|
if stderr_str:
|
||||||
out_parts.append(f"<b>خروجی خطا (stderr):</b>\n<pre>{escape_html(stderr_str[:1500])}</pre>")
|
out_parts.append(f"<b>خروجی خطا / وضعیت:</b>\n<pre>{escape_html(stderr_str[:1500])}</pre>")
|
||||||
if not out_parts:
|
if not out_parts:
|
||||||
out_parts.append("<i>(بدون خروجی)</i>")
|
out_parts.append("<i>(بدون خروجی)</i>")
|
||||||
|
|
||||||
output_text = "\n\n".join(out_parts)
|
output_text = "\n\n".join(out_parts)
|
||||||
success = (proc.returncode == 0)
|
|
||||||
|
|
||||||
elif task.task_type == "reminder":
|
elif task.task_type == "reminder":
|
||||||
output_text = task.content
|
output_text = task.content
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user