@@ -31,7 +31,10 @@ export async function validateHostRequirements(browserPath: string, browser: Bro
3131 const ubuntuVersion = await getUbuntuVersion ( ) ;
3232 if ( browser . name === 'firefox' && ubuntuVersion === '16.04' )
3333 throw new Error ( `Cannot launch firefox on Ubuntu 16.04! Minimum required Ubuntu version for Firefox browser is 18.04` ) ;
34- await validateDependencies ( browserPath , browser ) ;
34+ if ( os . platform ( ) === 'linux' )
35+ return await validateDependenciesLinux ( browserPath , browser ) ;
36+ if ( os . platform ( ) === 'win32' && os . arch ( ) === 'x64' )
37+ return await validateDependenciesWindows ( browserPath , browser ) ;
3538}
3639
3740const DL_OPEN_LIBRARIES = {
@@ -41,12 +44,14 @@ const DL_OPEN_LIBRARIES = {
4144 clank : [ ] ,
4245} ;
4346
44- async function validateDependencies ( browserPath : string , browser : BrowserDescriptor ) {
45- // We currently only support Linux.
46- if ( os . platform ( ) === 'linux' )
47- return await validateDependenciesLinux ( browserPath , browser ) ;
48- if ( os . platform ( ) === 'win32' && os . arch ( ) === 'x64' )
49- return await validateDependenciesWindows ( browserPath , browser ) ;
47+ function isSupportedWindowsVersion ( ) : boolean {
48+ if ( os . platform ( ) !== 'win32' || os . arch ( ) !== 'x64' )
49+ return false ;
50+ const [ major , minor ] = os . release ( ) . split ( '.' ) . map ( token => parseInt ( token , 10 ) ) ;
51+ // This is based on: https://stackoverflow.com/questions/42524606/how-to-get-windows-version-using-node-js/44916050#44916050
52+ // The table with versions is taken from: https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-osversioninfoexw#remarks
53+ // Windows 7 is not supported and is encoded as `6.1`.
54+ return major > 6 || ( major === 6 && minor > 1 ) ;
5055}
5156
5257async function validateDependenciesWindows ( browserPath : string , browser : BrowserDescriptor ) {
@@ -101,7 +106,13 @@ async function validateDependenciesWindows(browserPath: string, browser: Browser
101106 ` ${ [ ...missingDeps ] . join ( '\n ' ) } ` ,
102107 `` ) ;
103108
104- throw new Error ( `Host system is missing dependencies!\n\n${ details . join ( '\n' ) } ` ) ;
109+ const message = `Host system is missing dependencies!\n\n${ details . join ( '\n' ) } ` ;
110+ if ( isSupportedWindowsVersion ( ) ) {
111+ throw new Error ( message ) ;
112+ } else {
113+ console . warn ( `WARNING: running on unsupported windows version!` ) ;
114+ console . warn ( message ) ;
115+ }
105116}
106117
107118async function validateDependenciesLinux ( browserPath : string , browser : BrowserDescriptor ) {
0 commit comments