Updated exec_cmd to allow capturing while in debug mode

This commit is contained in:
Antoine Nguyen
2023-08-30 14:17:04 +02:00
parent 4782000791
commit 23aabbfffc
2 changed files with 19 additions and 20 deletions

View File

@@ -68,7 +68,7 @@ class DEBPackage(Package):
def get_installed_version(self, name):
"""Get installed package version."""
code, output = utils.exec_cmd(
"dpkg -s {} | grep Version".format(name), capture_output=True)
"dpkg -s {} | grep Version".format(name))
match = re.match(r"Version: (\d:)?(.+)-\d", output.decode())
if match:
return match.group(2)
@@ -97,7 +97,7 @@ class RPMPackage(Package):
def get_installed_version(self, name):
"""Get installed package version."""
code, output = utils.exec_cmd(
"rpm -qi {} | grep Version".format(name), capture_output=True)
"rpm -qi {} | grep Version".format(name))
match = re.match(r"Version\s+: (.+)", output.decode())
if match:
return match.group(1)