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):
LOG.info('Getting installed packages')
packages = subprocess.Popen("dism /online /get-packages", shell=True, stdout=subprocess.PIPE).stdout.read()
try:
self.info["installed_packages"] = packages.decode('utf-8')
except UnicodeDecodeError:
self.info["installed_packages"] = packages.decode('raw-unicode-escape')
packages = subprocess.check_output("dism /online /get-packages", shell=True)
self.info["installed_packages"] = packages.decode('utf-8', errors='ignore')
features = subprocess.Popen("dism /online /get-features", shell=True, stdout=subprocess.PIPE).stdout.read()
try:
self.info["installed_features"] = features.decode('utf-8')
except UnicodeDecodeError:
self.info["installed_features"] = features.decode('raw-unicode-escape')
features = subprocess.check_output("dism /online /get-features", shell=True)
self.info["installed_features"] = features.decode('utf-8', errors='ignore')
LOG.debug('Got installed packages')