mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-01-29 22:02:05 +00:00
fix: prevent agent subprocess blocking on Windows
- Add stdin=subprocess.DEVNULL to prevent blocking on stdin reads - Add CREATE_NO_WINDOW flag on Windows to prevent console pop-ups - Remove trailing pause from start_ui.bat Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -299,14 +299,19 @@ class ParallelOrchestrator:
|
|||||||
cmd.append("--yolo")
|
cmd.append("--yolo")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
proc = subprocess.Popen(
|
# CREATE_NO_WINDOW on Windows prevents console window pop-ups
|
||||||
cmd,
|
popen_kwargs = {
|
||||||
stdout=subprocess.PIPE,
|
"stdin": subprocess.DEVNULL,
|
||||||
stderr=subprocess.STDOUT,
|
"stdout": subprocess.PIPE,
|
||||||
text=True,
|
"stderr": subprocess.STDOUT,
|
||||||
cwd=str(AUTOCODER_ROOT), # Run from autocoder root for proper imports
|
"text": True,
|
||||||
env={**os.environ, "PYTHONUNBUFFERED": "1"},
|
"cwd": str(AUTOCODER_ROOT), # Run from autocoder root for proper imports
|
||||||
)
|
"env": {**os.environ, "PYTHONUNBUFFERED": "1"},
|
||||||
|
}
|
||||||
|
if sys.platform == "win32":
|
||||||
|
popen_kwargs["creationflags"] = subprocess.CREATE_NO_WINDOW
|
||||||
|
|
||||||
|
proc = subprocess.Popen(cmd, **popen_kwargs)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# Reset in_progress on failure
|
# Reset in_progress on failure
|
||||||
session = self.get_session()
|
session = self.get_session()
|
||||||
|
|||||||
@@ -341,12 +341,18 @@ class AgentProcessManager:
|
|||||||
try:
|
try:
|
||||||
# Start subprocess with piped stdout/stderr
|
# Start subprocess with piped stdout/stderr
|
||||||
# Use project_dir as cwd so Claude SDK sandbox allows access to project files
|
# Use project_dir as cwd so Claude SDK sandbox allows access to project files
|
||||||
self.process = subprocess.Popen(
|
# stdin=DEVNULL prevents blocking if Claude CLI or child process tries to read stdin
|
||||||
cmd,
|
# CREATE_NO_WINDOW on Windows prevents console window pop-ups
|
||||||
stdout=subprocess.PIPE,
|
popen_kwargs = {
|
||||||
stderr=subprocess.STDOUT,
|
"stdin": subprocess.DEVNULL,
|
||||||
cwd=str(self.project_dir),
|
"stdout": subprocess.PIPE,
|
||||||
)
|
"stderr": subprocess.STDOUT,
|
||||||
|
"cwd": str(self.project_dir),
|
||||||
|
}
|
||||||
|
if sys.platform == "win32":
|
||||||
|
popen_kwargs["creationflags"] = subprocess.CREATE_NO_WINDOW
|
||||||
|
|
||||||
|
self.process = subprocess.Popen(cmd, **popen_kwargs)
|
||||||
|
|
||||||
# Atomic lock creation - if it fails, another process beat us
|
# Atomic lock creation - if it fails, another process beat us
|
||||||
if not self._create_lock():
|
if not self._create_lock():
|
||||||
|
|||||||
@@ -39,5 +39,3 @@ pip install -r requirements.txt --quiet
|
|||||||
|
|
||||||
REM Run the Python launcher
|
REM Run the Python launcher
|
||||||
python "%~dp0start_ui.py" %*
|
python "%~dp0start_ui.py" %*
|
||||||
|
|
||||||
pause
|
|
||||||
|
|||||||
Reference in New Issue
Block a user