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,12 +111,17 @@ function downloadURL(
function handleArm64(): void { function handleArm64(): void {
fs.stat('/usr/bin/chromium-browser', function (err, stats) { fs.stat('/usr/bin/chromium-browser', function (err, stats) {
if (stats === undefined) { if (stats === undefined) {
console.error(`The chromium binary is not available for arm64: `); 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(`If you are on Ubuntu, you can install with: `);
console.error(`\n apt-get install chromium-browser\n`); console.error(`\n sudo apt install chromium\n`);
console.error(`\n sudo apt install chromium-browser\n`);
throw new Error(); throw new Error();
} }
}); });
}
});
} }
const readdirAsync = promisify(fs.readdir.bind(fs)); const readdirAsync = promisify(fs.readdir.bind(fs));
const mkdirAsync = promisify(fs.mkdir.bind(fs)); const mkdirAsync = promisify(fs.mkdir.bind(fs));

View File

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