From 52e66dec35e01678b664f75b45a4735c9ae71d1f Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Mon, 10 Jul 2023 22:36:12 +0200 Subject: [PATCH] chore: hide Batch window on win32 (#2004) --- playwright/_impl/_transport.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/playwright/_impl/_transport.py b/playwright/_impl/_transport.py index 5565c62b7..3c9f96be0 100644 --- a/playwright/_impl/_transport.py +++ b/playwright/_impl/_transport.py @@ -16,6 +16,7 @@ import io import json import os +import subprocess import sys from abc import ABC, abstractmethod from pathlib import Path @@ -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", @@ -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)