Skip to content

Commit

Permalink
chore: hide Batch window on win32 (#2004)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt authored Jul 10, 2023
1 parent 0620596 commit 52e66de
Showing 1 changed file with 8 additions and 0 deletions.
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

0 comments on commit 52e66de

Please sign in to comment.