Skip to content

Commit 998e566

Browse files
committed
fix(cli): hide Windows daemon consoles
Hide detached CLI and dashboard daemon windows, and prevent taskkill from flashing a console while replacing or closing sessions. Browser process launches remain unchanged so headed mode, Inspector, and UI mode stay visible.\n\nFixes: https://github.com/microsoft/playwright/issues/42152\n\nCo-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: 37896276-261f-4ff0-9664-06aa7dfc471b
1 parent b4a646a commit 998e566

4 files changed

Lines changed: 4 additions & 2 deletions

File tree

packages/playwright-core/src/tools/backend/devtools.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ const annotate = defineTabTool({
135135
const daemonArgs = [daemonScript, `--pageId=${pageId}`];
136136

137137
// Spawn the dashboard daemon (idempotent — the singleton socket guards against duplicates).
138-
const daemon = spawn(process.execPath, daemonArgs, { detached: true, stdio: 'ignore' });
138+
const daemon = spawn(process.execPath, daemonArgs, { detached: true, stdio: 'ignore', windowsHide: true });
139139
daemon.unref();
140140

141141
// Spawn the annotate client in JSON mode to capture the raw payload over stdout.

packages/playwright-core/src/tools/cli-client/program.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ export async function program(options?: { embedderVersion?: string}) {
248248
const child = spawn(process.execPath, daemonArgs, {
249249
detached: !foreground,
250250
stdio: foreground ? 'inherit' : ['pipe', 'pipe', 'ignore'],
251+
windowsHide: true,
251252
});
252253
if (foreground) {
253254
await new Promise<void>(resolve => child.on('exit', () => resolve()));

packages/playwright-core/src/tools/cli-client/session.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ export class Session {
148148
detached: true,
149149
stdio: ['ignore', 'pipe', err],
150150
cwd: process.cwd(), // Will be used as root.
151+
windowsHide: true,
151152
});
152153

153154
let signalled = false;

packages/utils/processLauncher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ export async function launchProcess(options: LaunchProcessOptions): Promise<Laun
233233
// Force kill the browser.
234234
try {
235235
if (process.platform === 'win32') {
236-
const taskkillProcess = childProcess.spawnSync(`taskkill /pid ${spawnedProcess.pid} /T /F`, { shell: true });
236+
const taskkillProcess = childProcess.spawnSync(`taskkill /pid ${spawnedProcess.pid} /T /F`, { shell: true, windowsHide: true });
237237
const [stdout, stderr] = [taskkillProcess.stdout.toString(), taskkillProcess.stderr.toString()];
238238
if (stdout)
239239
options.log(`[pid=${spawnedProcess.pid}] taskkill stdout: ${stdout}`);

0 commit comments

Comments
 (0)