Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix: do not show taskkill.exe output (#10244)
Max Schmitt3a64da7a54fe
diff --git a/packages/playwright-core/src/utils/processLauncher.ts b/packages/playwright-core/src/utils/processLauncher.tsindex 5459340b39..79dc2e8d4a 100644--- a/packages/playwright-core/src/utils/processLauncher.ts+++ b/packages/playwright-core/src/utils/processLauncher.ts@@ -172,8 +172,12 @@ export async function launchProcess(options: LaunchProcessOptions): Promise<Laun// Force kill the browser.try {if (process.platform === 'win32') {- const stdout = childProcess.execSync(`taskkill /pid ${spawnedProcess.pid} /T /F /FI "MEMUSAGE gt 0"`);- options.log(`[pid=${spawnedProcess.pid}] taskkill output: ${stdout.toString()}`);+ const taskkillProcess = childProcess.spawnSync(`taskkill /pid ${spawnedProcess.pid} /T /F /FI "MEMUSAGE gt 0"`, { shell: true });+ const [stderr, stdout] = [taskkillProcess.stdout.toString(), taskkillProcess.stderr.toString()];+ if (stdout)+ options.log(`[pid=${spawnedProcess.pid}] taskkill stdout: ${stdout}`);+ if (stderr)+ options.log(`[pid=${spawnedProcess.pid}] taskkill stderr: ${stderr}`);} else {process.kill(-spawnedProcess.pid, 'SIGKILL');}diff --git a/tests/config/commonFixtures.ts b/tests/config/commonFixtures.tsindex 86e70bc8fe..e6d2661e51 100644--- a/tests/config/commonFixtures.ts+++ b/tests/config/commonFixtures.ts@@ -87,7 +87,7 @@ export class TestChildProcess {return;try {if (process.platform === 'win32')- execSync(`taskkill /pid ${this.process.pid} /T /F /FI "MEMUSAGE gt 0"`);+ execSync(`taskkill /pid ${this.process.pid} /T /F /FI "MEMUSAGE gt 0"`, { stdio: 'ignore' });elseprocess.kill(-this.process.pid, 'SIGKILL');} catch (e) {diff --git a/tests/signals.spec.ts b/tests/signals.spec.tsindex 32225ade76..fb59bc182c 100644--- a/tests/signals.spec.ts+++ b/tests/signals.spec.ts@@ -23,7 +23,7 @@ test.slow();test('should close the browser when the node process closes', async ({ startRemoteServer, isWindows, server }) => {const remoteServer = await startRemoteServer({ url: server.EMPTY_PAGE });if (isWindows)- execSync(`taskkill /pid ${remoteServer.child().pid} /T /F`);+ execSync(`taskkill /pid ${remoteServer.child().pid} /T /F`, { stdio: 'ignore' });elseprocess.kill(remoteServer.child().pid);// We might not get browser exitCode in time when killing the parent node process,