From bff84c53918d6cbe4e1a939b5936f0bee199ce13 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Fri, 29 Oct 2021 22:42:51 +0200 Subject: [PATCH] fix: PowerShell execution policies (#9885) --- packages/playwright-core/src/utils/dependencies.ts | 2 +- packages/playwright-core/src/utils/registry.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/playwright-core/src/utils/dependencies.ts b/packages/playwright-core/src/utils/dependencies.ts index d52e4b6df3..bbac2ba2a7 100644 --- a/packages/playwright-core/src/utils/dependencies.ts +++ b/packages/playwright-core/src/utils/dependencies.ts @@ -40,7 +40,7 @@ export type DependencyGroup = 'chromium' | 'firefox' | 'webkit' | 'tools'; export async function installDependenciesWindows(targets: Set) { if (targets.has('chromium')) { - const { code } = await utils.spawnAsync('powershell.exe', ['-File', path.join(BIN_DIRECTORY, 'install_media_pack.ps1')], { cwd: BIN_DIRECTORY, stdio: 'inherit' }); + const { code } = await utils.spawnAsync('powershell.exe', ['-ExecutionPolicy', 'Bypass', '-File', path.join(BIN_DIRECTORY, 'install_media_pack.ps1')], { cwd: BIN_DIRECTORY, stdio: 'inherit' }); if (code !== 0) throw new Error('Failed to install windows dependencies!'); } diff --git a/packages/playwright-core/src/utils/registry.ts b/packages/playwright-core/src/utils/registry.ts index 59b4d149d6..5286f027d1 100644 --- a/packages/playwright-core/src/utils/registry.ts +++ b/packages/playwright-core/src/utils/registry.ts @@ -625,7 +625,7 @@ export class Registry { const isPowerShell = scriptName.endsWith('.ps1'); const shell = isPowerShell ? 'powershell.exe' : 'bash'; const args = [ - ...(isPowerShell ? ['-File'] : []), + ...(isPowerShell ? ['-ExecutionPolicy', 'Bypass', '-File'] : []), path.join(BIN_PATH, scriptName), ...scriptArgs ];