diff --git a/src/utils/dependencies.ts b/src/utils/dependencies.ts index 1d9a5e67b1..bc8f51e864 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) { 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 e26074e7d2..d0f68fa291 100644 --- a/src/utils/registry.ts +++ b/src/utils/registry.ts @@ -630,8 +630,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}`); }