fix(launchdoctor): make launch doctor to warn on Win7 (#4718)
Windows 7 was end-of-lifed on January 14, 2020. We don't support this system, but we'd like to have a best-effort to work there. It does look like Chromium is missing some libraries on Win 7, however it still manages to work there. To support this usecase, this patch starts printing console warning about missing libraries on Win 7 only instead of refusing to launch. Fixes #3496
This commit is contained in:
parent
355a58e616
commit
b09e0d01bd
|
|
@ -31,7 +31,10 @@ export async function validateHostRequirements(browserPath: string, browser: Bro
|
||||||
const ubuntuVersion = await getUbuntuVersion();
|
const ubuntuVersion = await getUbuntuVersion();
|
||||||
if (browser.name === 'firefox' && ubuntuVersion === '16.04')
|
if (browser.name === 'firefox' && ubuntuVersion === '16.04')
|
||||||
throw new Error(`Cannot launch firefox on Ubuntu 16.04! Minimum required Ubuntu version for Firefox browser is 18.04`);
|
throw new Error(`Cannot launch firefox on Ubuntu 16.04! Minimum required Ubuntu version for Firefox browser is 18.04`);
|
||||||
await validateDependencies(browserPath, browser);
|
if (os.platform() === 'linux')
|
||||||
|
return await validateDependenciesLinux(browserPath, browser);
|
||||||
|
if (os.platform() === 'win32' && os.arch() === 'x64')
|
||||||
|
return await validateDependenciesWindows(browserPath, browser);
|
||||||
}
|
}
|
||||||
|
|
||||||
const DL_OPEN_LIBRARIES = {
|
const DL_OPEN_LIBRARIES = {
|
||||||
|
|
@ -41,12 +44,14 @@ const DL_OPEN_LIBRARIES = {
|
||||||
clank: [],
|
clank: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
async function validateDependencies(browserPath: string, browser: BrowserDescriptor) {
|
function isSupportedWindowsVersion(): boolean {
|
||||||
// We currently only support Linux.
|
if (os.platform() !== 'win32' || os.arch() !== 'x64')
|
||||||
if (os.platform() === 'linux')
|
return false;
|
||||||
return await validateDependenciesLinux(browserPath, browser);
|
const [major, minor] = os.release().split('.').map(token => parseInt(token, 10));
|
||||||
if (os.platform() === 'win32' && os.arch() === 'x64')
|
// This is based on: https://stackoverflow.com/questions/42524606/how-to-get-windows-version-using-node-js/44916050#44916050
|
||||||
return await validateDependenciesWindows(browserPath, browser);
|
// The table with versions is taken from: https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-osversioninfoexw#remarks
|
||||||
|
// Windows 7 is not supported and is encoded as `6.1`.
|
||||||
|
return major > 6 || (major === 6 && minor > 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function validateDependenciesWindows(browserPath: string, browser: BrowserDescriptor) {
|
async function validateDependenciesWindows(browserPath: string, browser: BrowserDescriptor) {
|
||||||
|
|
@ -101,7 +106,13 @@ async function validateDependenciesWindows(browserPath: string, browser: Browser
|
||||||
` ${[...missingDeps].join('\n ')}`,
|
` ${[...missingDeps].join('\n ')}`,
|
||||||
``);
|
``);
|
||||||
|
|
||||||
throw new Error(`Host system is missing dependencies!\n\n${details.join('\n')}`);
|
const message = `Host system is missing dependencies!\n\n${details.join('\n')}`;
|
||||||
|
if (isSupportedWindowsVersion()) {
|
||||||
|
throw new Error(message);
|
||||||
|
} else {
|
||||||
|
console.warn(`WARNING: running on unsupported windows version!`);
|
||||||
|
console.warn(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function validateDependenciesLinux(browserPath: string, browser: BrowserDescriptor) {
|
async function validateDependenciesLinux(browserPath: string, browser: BrowserDescriptor) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue