Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(mcp): proper daemon check on windows (#38969)

Dmitry Gozman71e5079b735e
diff --git a/packages/playwright/src/mcp/terminal/program.ts b/packages/playwright/src/mcp/terminal/program.ts
index b48f89e776..9552ee4088 100644
--- a/packages/playwright/src/mcp/terminal/program.ts
+++ b/packages/playwright/src/mcp/terminal/program.ts
@@ -190,11 +190,7 @@ class SessionManager {
const socketPath = this._daemonSocketPath(sessionName);
debugCli(`Connecting to daemon at ${socketPath}`);
- const socketExists = await fs.promises.stat(socketPath)
- .then(stat => stat?.isSocket() ?? false)
- .catch(() => false);
-
- if (socketExists) {
+ if (await this._canConnect(sessionName)) {
debugCli(`Socket file exists, attempting to connect...`);
try {
return await this._connectToSocket(sessionName, socketPath);