Skip to content

chore: hide Batch window on win32 #2004

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2023
Merged
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
8 changes: 8 additions & 0 deletions playwright/_impl/_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import io
import json
import os
import subprocess
import sys
from abc import ABC, abstractmethod
from pathlib import Path
Expand Down Expand Up @@ -113,6 +114,12 @@ async def connect(self) -> None:
if getattr(sys, "frozen", False):
env.setdefault("PLAYWRIGHT_BROWSERS_PATH", "0")

startupinfo = None
if sys.platform == "win32":
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = subprocess.SW_HIDE

self._proc = await asyncio.create_subprocess_exec(
str(self._driver_executable),
"run-driver",
Expand All @@ -121,6 +128,7 @@ async def connect(self) -> None:
stderr=_get_stderr_fileno(),
limit=32768,
env=env,
startupinfo=startupinfo,
)
except Exception as exc:
self.on_error_future.set_exception(exc)
Expand Down