Skip to content

Commit 52e66de

Browse files
authored
chore: hide Batch window on win32 (#2004)
1 parent 0620596 commit 52e66de

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

playwright/_impl/_transport.py

+8
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import io
1717
import json
1818
import os
19+
import subprocess
1920
import sys
2021
from abc import ABC, abstractmethod
2122
from pathlib import Path
@@ -113,6 +114,12 @@ async def connect(self) -> None:
113114
if getattr(sys, "frozen", False):
114115
env.setdefault("PLAYWRIGHT_BROWSERS_PATH", "0")
115116

117+
startupinfo = None
118+
if sys.platform == "win32":
119+
startupinfo = subprocess.STARTUPINFO()
120+
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
121+
startupinfo.wShowWindow = subprocess.SW_HIDE
122+
116123
self._proc = await asyncio.create_subprocess_exec(
117124
str(self._driver_executable),
118125
"run-driver",
@@ -121,6 +128,7 @@ async def connect(self) -> None:
121128
stderr=_get_stderr_fileno(),
122129
limit=32768,
123130
env=env,
131+
startupinfo=startupinfo,
124132
)
125133
except Exception as exc:
126134
self.on_error_future.set_exception(exc)

0 commit comments

Comments
 (0)