Skip to content

Hide subprocess terminal for Windows system #480

@MrYangxf

Description

@MrYangxf

Issue

When spawn Claude subprocess via SDK on Windows, a terminal window remains visible. Need to hide the terminal for a cleaner UX.

Workaround

before

self._process = await anyio.open_process(
cmd,
stdin=PIPE,
stdout=PIPE,
stderr=stderr_dest,
cwd=self._cwd,
env=process_env,
user=self._options.user,
)

after

if sys.platform == "win32":
    import subprocess
    creationflags = subprocess.CREATE_NO_WINDOW

self._process = await anyio.open_process(
    cmd,
    stdin=PIPE,
    stdout=PIPE,
    stderr=stderr_dest,
    cwd=self._cwd,
    env=process_env,
    user=self._options.user,
    creationflags=creationflags if creationflags else 0
)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions