Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix: installation with folders which contain spaces (#9275)

Max Schmitt771dd83c166d
diff --git a/src/utils/dependencies.ts b/src/utils/dependencies.ts
index 0eaa7b091b..299b39ec02 100644
--- a/src/utils/dependencies.ts
+++ b/src/utils/dependencies.ts
@@ -39,7 +39,7 @@ export type DependencyGroup = 'chromium' | 'firefox' | 'webkit' | 'tools';
export async function installDependenciesWindows(targets: Set<DependencyGroup>) {
if (targets.has('chromium')) {
- const { code } = await utils.spawnAsync('powershell.exe', [path.join(BIN_DIRECTORY, 'install_media_pack.ps1')], { cwd: BIN_DIRECTORY, stdio: 'inherit' });
+ const { code } = await utils.spawnAsync('powershell.exe', ['-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/src/utils/registry.ts b/src/utils/registry.ts
index 3efc2a58a3..9323533249 100644
--- a/src/utils/registry.ts
+++ b/src/utils/registry.ts
@@ -632,8 +632,14 @@ export class Registry {
const scriptName = scripts[process.platform as 'linux' | 'darwin' | 'win32'];
if (!scriptName)
throw new Error(`Cannot install ${channel} on ${process.platform}`);
- const shell = scriptName.endsWith('.ps1') ? 'powershell.exe' : 'bash';
- const { code } = await spawnAsync(shell, [path.join(BIN_PATH, scriptName), ...scriptArgs], { cwd: BIN_PATH, stdio: 'inherit' });
+ const isPowerShell = scriptName.endsWith('.ps1');
+ const shell = isPowerShell ? 'powershell.exe' : 'bash';
+ const args = [
+ ...(isPowerShell ? ['-File'] : []),
+ path.join(BIN_PATH, scriptName),
+ ...scriptArgs
+ ];
+ const { code } = await spawnAsync(shell, args, { cwd: BIN_PATH, stdio: 'inherit' });
if (code !== 0)
throw new Error(`Failed to install ${channel}`);
}