File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -115,17 +115,27 @@ def get_filename_from_response(response, name):
115115 return filename
116116
117117
118+ def linux_browser_apps_to_cmd (* apps : str ) -> str :
119+ """Create chrome version command from browser app names.
120+
121+ Result command example:
122+ chromium --version || chromium-browser --version
123+ """
124+ ignore_errors_cmd_part = ' 2>/dev/null' if os .getenv ('WDM_LOG_LEVEL' ) == '0' else ''
125+ return ' || ' .join (list (map (lambda i : f'{ i } --version{ ignore_errors_cmd_part } ' , apps )))
126+
127+
118128def chrome_version (browser_type = ChromeType .GOOGLE ):
119129 pattern = r'\d+\.\d+\.\d+'
120130
121131 cmd_mapping = {
122132 ChromeType .GOOGLE : {
123- OSType .LINUX : 'google-chrome --version || google-chrome-stable --version' ,
133+ OSType .LINUX : linux_browser_apps_to_cmd ( 'google-chrome' , ' google-chrome-stable' ) ,
124134 OSType .MAC : r'/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version' ,
125135 OSType .WIN : r'reg query "HKEY_CURRENT_USER\Software\Google\Chrome\BLBeacon" /v version'
126136 },
127137 ChromeType .CHROMIUM : {
128- OSType .LINUX : 'chromium --version || chromium-browser --version' ,
138+ OSType .LINUX : linux_browser_apps_to_cmd ( 'chromium' , ' chromium-browser' ) ,
129139 OSType .MAC : r'/Applications/Chromium.app/Contents/MacOS/Chromium --version' ,
130140 OSType .WIN : r'reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome" /v version'
131141 },
You can’t perform that action at this time.
0 commit comments