feat: support fetching and launching on Apple M1

Issue: #6495, #6634, #6641, #6614
This commit is contained in:
Alex Smith 2021-01-08 14:35:48 +05:00 committed by Mathias Bynens
parent 50b810dab7
commit 9a8479a52a
2 changed files with 17 additions and 10 deletions

View File

@ -111,10 +111,15 @@ function downloadURL(
function handleArm64(): void {
fs.stat('/usr/bin/chromium-browser', function (err, stats) {
if (stats === undefined) {
console.error(`The chromium binary is not available for arm64: `);
console.error(`If you are on Ubuntu, you can install with: `);
console.error(`\n apt-get install chromium-browser\n`);
throw new Error();
fs.stat('/usr/bin/chromium', function (err, stats) {
if (stats === undefined) {
console.error(`The chromium binary is not available for arm64.`);
console.error(`If you are on Ubuntu, you can install with: `);
console.error(`\n sudo apt install chromium\n`);
console.error(`\n sudo apt install chromium-browser\n`);
throw new Error();
}
});
}
});
}

View File

@ -104,12 +104,14 @@ class ChromeLauncher implements ProductLauncher {
}
let chromeExecutable = executablePath;
if (os.arch() === 'arm64') {
chromeExecutable = '/usr/bin/chromium-browser';
} else if (!executablePath) {
const { missingText, executablePath } = resolveExecutablePath(this);
if (missingText) throw new Error(missingText);
chromeExecutable = executablePath;
if (!executablePath) {
if (os.arch() === 'arm64') {
chromeExecutable = '/usr/bin/chromium-browser';
} else {
const { missingText, executablePath } = resolveExecutablePath(this);
if (missingText) throw new Error(missingText);
chromeExecutable = executablePath;
}
}
const usePipe = chromeArguments.includes('--remote-debugging-pipe');