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

This commit is contained in:
Max Schmitt 2021-10-04 10:25:15 +02:00 committed by GitHub
parent 913821f675
commit 771dd83c16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View file

@ -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!');
}

View file

@ -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}`);
}