fix(install): check macOS version to be 10.14 or higher (#671)

Fixes #669
This commit is contained in:
Pavel Feldman 2020-01-27 09:37:33 -08:00 committed by Andrey Lushnikov
parent e65cc77f31
commit 6e4bf9561b

View file

@ -224,9 +224,11 @@ const mkdtempAsync = platform.promisify(fs.mkdtemp);
const WEBKIT_PROFILE_PATH = path.join(os.tmpdir(), 'playwright_dev_profile-');
let cachedMacVersion: string | undefined = undefined;
function getMacVersion() {
function getMacVersion(): string {
if (!cachedMacVersion) {
const [major, minor] = execSync('sw_vers -productVersion').toString('utf8').trim().split('.');
assert(+major === 10 && +minor >= 14, 'Error: unsupported macOS version, macOS 10.14 and newer are supported');
cachedMacVersion = major + '.' + minor;
}
return cachedMacVersion;