Skip to content

Commit

Permalink
Handle multiple lines in "repoquery" output; also don't shell out jus…
Browse files Browse the repository at this point in the history
…t to call head(1)
  • Loading branch information
matyasselmeci committed Oct 23, 2023
1 parent 7960ab5 commit d4c07c3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions yumconf.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ def yum_clean(self):
subprocess.call(["yum", "clean", "all"] + args, stdout=fnull)

def _get_yum_major_version(self):
proc = subprocess.Popen("yum --version | head -n1", shell=True, stdout=subprocess.PIPE)
output = to_str(proc.communicate()[0]).strip()
proc = subprocess.Popen(["yum", "--version"], stdout=subprocess.PIPE)
output = to_str(proc.communicate()[0]).strip().splitlines()[0]
version = output.split(".")
try:
return int(version[0])
Expand All @@ -125,7 +125,7 @@ def repoquery(self, *args):
cmd.extend(self.repo_args)
cmd.extend(args)
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
output = to_str(proc.communicate()[0])
output = to_str(proc.communicate()[0]).splitlines()[0]
retcode = proc.returncode

if not retcode:
Expand Down

0 comments on commit d4c07c3

Please sign in to comment.