From cb92516e93d1419e977842ff4a5d153701132f95 Mon Sep 17 00:00:00 2001 From: Daniel Gus Date: Mon, 19 Oct 2026 07:23:11 -0700 Subject: [PATCH] fix(video): hide the ffmpeg console window on Windows launchProcess() builds its spawn() options without windowsHide, so on Windows the ffmpeg process started for video recording gets a console window of its own (inherited from the terminal, or newly created when the parent has none - e.g. the CLI session daemon, which has run detached with windowsHide: true since #42155). One window appears per recording and steals focus. #41630 asked for windowsHide on every launchProcess call, but that was closed as not planned: an earlier attempt (#38776) was reverted in #39994 after it broke Inspector, codegen and UI mode (#39990), since those processes do have real windows of their own. ffmpeg has none, so make windowsHide an opt-in LaunchProcessOptions field and set it only for the ffmpeg launch in videoRecorder.ts, leaving every other launchProcess call unaffected. Fixes #43515 --- packages/playwright-core/src/server/videoRecorder.ts | 3 +++ packages/utils/processLauncher.ts | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/packages/playwright-core/src/server/videoRecorder.ts b/packages/playwright-core/src/server/videoRecorder.ts index 20261820cd659..bb5872766659e 100644 --- a/packages/playwright-core/src/server/videoRecorder.ts +++ b/packages/playwright-core/src/server/videoRecorder.ts @@ -209,6 +209,9 @@ class FfmpegVideoRecorder { command: this._ffmpegPath, args, stdio: 'stdin', + // ffmpeg has no window of its own, so hiding its console on Windows is safe here, + // unlike for browser/driver processes. See https://github.com/microsoft/playwright/issues/43515. + windowsHide: true, log: (message: string) => debugLogger.log('browser', message), tempDirectories: [], attemptToGracefullyClose: async () => { diff --git a/packages/utils/processLauncher.ts b/packages/utils/processLauncher.ts index 14a982d66e4d4..5c00deb303c5a 100644 --- a/packages/utils/processLauncher.ts +++ b/packages/utils/processLauncher.ts @@ -30,6 +30,10 @@ export type LaunchProcessOptions = { args?: string[], env?: NodeJS.ProcessEnv, shell?: boolean, + // Only pass this for child processes that have no window of their own (e.g. ffmpeg). + // See https://github.com/microsoft/playwright/issues/43515: passing this unconditionally + // for every launched process previously broke Inspector, codegen and UI mode. + windowsHide?: boolean, handleSIGINT?: boolean, handleSIGTERM?: boolean, @@ -142,6 +146,7 @@ export async function launchProcess(options: LaunchProcessOptions): Promise