From 3e6650e502ef92e122904e0034feeea0b00ad9ac Mon Sep 17 00:00:00 2001 From: MyNameIsEdi Date: Mon, 25 May 2026 13:14:02 +0300 Subject: [PATCH] =?UTF-8?q?fix(server):=20revert=20playwright=20spawn=20to?= =?UTF-8?q?=20npx=20=E2=80=94=20node=20cli.js=20exits=20immediately=20on?= =?UTF-8?q?=20Windows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Direct node spawn with shell:false does not replicate the Windows console handle inheritance that cmd.exe provides; playwright exits with no output. Reverts to npx playwright with shell:true on win32. The non-blocking remote warmup (the real startup speedup) is preserved. Co-Authored-By: Claude Sonnet 4.6 --- server/index.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/server/index.ts b/server/index.ts index 0667b0d1..b55a4a7d 100644 --- a/server/index.ts +++ b/server/index.ts @@ -1137,6 +1137,7 @@ app.get('/api/playwright/artifacts', (_req, res) => { } }); + app.post('/api/playwright/run', async (req, res) => { const { spec, @@ -1250,13 +1251,10 @@ app.post('/api/playwright/run', async (req, res) => { })(); } - // Use the local playwright CLI directly — avoids npx resolution overhead - // (saves 30-90s on Windows where npx+shell startup is expensive). - const pwCli = path.join(root, 'node_modules', '@playwright', 'test', 'cli.js'); - const child = spawn(process.execPath, [pwCli, ...args], { + const child = spawn('npx', ['playwright', ...args], { cwd: root, env, - shell: false, + shell: process.platform === 'win32', }); // Capture log lines so they're (a) persisted with the archived run and @@ -1590,11 +1588,10 @@ app.post('/api/run-dynamic-test', async (req, res) => { PW_RUNTIME_CONFIG: JSON.stringify({ testMatch: ['**/_dynamic_agent_test.spec.ts'] }), }; - const pwCli = path.join(root, 'node_modules', '@playwright', 'test', 'cli.js'); - const child = spawn(process.execPath, [pwCli, 'test'], { + const child = spawn('npx', ['playwright', 'test'], { cwd: root, env, - shell: false, + shell: process.platform === 'win32', }); // Capture every log line so we can persist them with the archived run.