mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-07 02:51:50 +00:00
fix(terminal): guard background process spawn against deleted cwd (#19933)
Follow-up to #19928 which fixed the foreground path in _run_bash. The background process spawn in process_registry.py had the same vulnerability: Popen(cwd=session.cwd) and PtyProcess.spawn(cwd=...) would raise FileNotFoundError if the directory was deleted. Apply _resolve_safe_cwd() at session creation time so both the PTY and pipe-mode Popen paths receive a validated cwd.
This commit is contained in:
parent
9fa3a093f2
commit
109c3e468c
1 changed files with 2 additions and 2 deletions
|
|
@ -41,7 +41,7 @@ import time
|
|||
import uuid
|
||||
|
||||
_IS_WINDOWS = platform.system() == "Windows"
|
||||
from tools.environments.local import _find_shell, _sanitize_subprocess_env
|
||||
from tools.environments.local import _find_shell, _resolve_safe_cwd, _sanitize_subprocess_env
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
|
|
@ -480,7 +480,7 @@ class ProcessRegistry:
|
|||
command=command,
|
||||
task_id=task_id,
|
||||
session_key=session_key,
|
||||
cwd=cwd or os.getcwd(),
|
||||
cwd=_resolve_safe_cwd(cwd or os.getcwd()),
|
||||
started_at=time.time(),
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue