Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/playwright-core/src/server/browserType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ export abstract class BrowserType extends SdkObject {
},
stdio: 'pipe',
tempDirectories: prepared.tempDirectories,
windowsHide: options.headless,
attemptToGracefullyClose: async () => {
if ((options as any).__testHookGracefullyClose)
await (options as any).__testHookGracefullyClose();
Expand Down
1 change: 1 addition & 0 deletions packages/playwright-core/src/server/videoRecorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ class FfmpegVideoRecorder {
stdio: 'stdin',
log: (message: string) => debugLogger.log('browser', message),
tempDirectories: [],
windowsHide: true,
attemptToGracefullyClose: async () => {
debugLogger.log('browser', 'Closing stdin...');
launchedProcess.stdin!.end();
Expand Down
4 changes: 3 additions & 1 deletion packages/utils/processLauncher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export type LaunchProcessOptions = {
args?: string[],
env?: NodeJS.ProcessEnv,
shell?: boolean,
windowsHide?: boolean,

handleSIGINT?: boolean,
handleSIGTERM?: boolean,
Expand Down Expand Up @@ -140,6 +141,7 @@ export async function launchProcess(options: LaunchProcessOptions): Promise<Laun
cwd: options.cwd,
shell: options.shell,
stdio,
windowsHide: options.windowsHide,
};
const spawnedProcess = childProcess.spawn(options.command, options.args || [], spawnOptions);

Expand Down Expand Up @@ -233,7 +235,7 @@ export async function launchProcess(options: LaunchProcessOptions): Promise<Laun
// Force kill the browser.
try {
if (process.platform === 'win32') {
const taskkillProcess = childProcess.spawnSync(`taskkill /pid ${spawnedProcess.pid} /T /F`, { shell: true });
const taskkillProcess = childProcess.spawnSync(`taskkill /pid ${spawnedProcess.pid} /T /F`, { shell: true, windowsHide: true });
const [stdout, stderr] = [taskkillProcess.stdout.toString(), taskkillProcess.stderr.toString()];
if (stdout)
options.log(`[pid=${spawnedProcess.pid}] taskkill stdout: ${stdout}`);
Expand Down