Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/claude_agent_sdk/_internal/transport/subprocess_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import platform
import re
import shutil
import subprocess
import sys
import tempfile
from collections.abc import AsyncIterable, AsyncIterator
Expand Down Expand Up @@ -36,6 +37,13 @@
# Other platforms have much higher limits
_CMD_LENGTH_LIMIT = 8000 if platform.system() == "Windows" else 100000

# Platform-specific process creation flags
# On Windows, CREATE_NO_WINDOW prevents a visible console window from appearing
# when spawning the CLI subprocess, which improves UX for GUI applications
_CREATION_FLAGS = (
subprocess.CREATE_NO_WINDOW if sys.platform == "win32" and hasattr(subprocess, "CREATE_NO_WINDOW") else 0
)


class SubprocessCLITransport(Transport):
"""Subprocess transport using Claude Code CLI."""
Expand Down Expand Up @@ -408,6 +416,7 @@ async def connect(self) -> None:
cwd=self._cwd,
env=process_env,
user=self._options.user,
creationflags=_CREATION_FLAGS,
)

if self._process.stdout:
Expand Down Expand Up @@ -636,6 +645,7 @@ async def _check_claude_version(self) -> None:
[self._cli_path, "-v"],
stdout=PIPE,
stderr=PIPE,
creationflags=_CREATION_FLAGS,
)

if version_process.stdout:
Expand Down
Loading