CR changes

This commit is contained in:
Shreya 2021-03-18 13:14:26 +05:30
parent 5192953dd0
commit a83c97519c
1 changed files with 4 additions and 10 deletions

View File

@ -48,17 +48,11 @@ class WindowsInfoCollector(InfoCollector):
def get_installed_packages(self): def get_installed_packages(self):
LOG.info('Getting installed packages') LOG.info('Getting installed packages')
packages = subprocess.Popen("dism /online /get-packages", shell=True, stdout=subprocess.PIPE).stdout.read() packages = subprocess.check_output("dism /online /get-packages", shell=True)
try: self.info["installed_packages"] = packages.decode('utf-8', errors='ignore')
self.info["installed_packages"] = packages.decode('utf-8')
except UnicodeDecodeError:
self.info["installed_packages"] = packages.decode('raw-unicode-escape')
features = subprocess.Popen("dism /online /get-features", shell=True, stdout=subprocess.PIPE).stdout.read() features = subprocess.check_output("dism /online /get-features", shell=True)
try: self.info["installed_features"] = features.decode('utf-8', errors='ignore')
self.info["installed_features"] = features.decode('utf-8')
except UnicodeDecodeError:
self.info["installed_features"] = features.decode('raw-unicode-escape')
LOG.debug('Got installed packages') LOG.debug('Got installed packages')