chromedriver 97.0.3 → 97.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/install.js +32 -3
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -86,16 +86,19 @@ function validatePlatform() {
86
86
  process.exit(1);
87
87
  }
88
88
  } else if (thePlatform === 'darwin' || thePlatform === 'freebsd') {
89
- if (process.arch === 'x64' || process.arch === 'arm64') {
90
- thePlatform = 'mac64';
91
- } else {
89
+ const osxPlatform = getMacOsRealArch();
90
+
91
+ if (!osxPlatform) {
92
92
  console.log('Only Mac 64 bits supported.');
93
93
  process.exit(1);
94
94
  }
95
+
96
+ thePlatform = osxPlatform;
95
97
  } else if (thePlatform !== 'win32') {
96
98
  console.log('Unexpected platform or architecture:', process.platform, process.arch);
97
99
  process.exit(1);
98
100
  }
101
+
99
102
  return thePlatform;
100
103
  }
101
104
 
@@ -336,6 +339,32 @@ function fixFilePermissions() {
336
339
  }
337
340
  }
338
341
 
342
+ function getMacOsRealArch() {
343
+ if (process.arch === 'arm64' || isEmulatedRosettaEnvironment()) {
344
+ return 'mac64_m1';
345
+ }
346
+
347
+ if (process.arch === 'x64') {
348
+ return 'mac64';
349
+ }
350
+
351
+ return null;
352
+ }
353
+
354
+ function isEmulatedRosettaEnvironment() {
355
+ const archName = child_process.spawnSync('uname', ['-m']).stdout.toString().trim();
356
+
357
+ if (archName === 'x86_64') {
358
+ const processTranslated = child_process.spawnSync('sysctl', ['-in', 'sysctl.proc_translated'])
359
+ .stdout.toString()
360
+ .trim();
361
+
362
+ return processTranslated === '1';
363
+ }
364
+
365
+ return false;
366
+ }
367
+
339
368
  function Deferred() {
340
369
  this.resolve = null;
341
370
  this.reject = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chromedriver",
3
- "version": "97.0.3",
3
+ "version": "97.0.4",
4
4
  "keywords": [
5
5
  "chromedriver",
6
6
  "selenium"