Browse Source

When checking unrar, prevent creating a zombie process on some systems.

pull/142/head
shypike 11 years ago
parent
commit
9cc9e0eaea
  1. 14
      sabnzbd/newsunpack.py

14
sabnzbd/newsunpack.py

@ -94,7 +94,7 @@ def find_programs(curdir):
if sabnzbd.DARWIN:
try:
os_version = subprocess.Popen("sw_vers -productVersion", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).stdout.read()
os_version = run_simple('sw_vers -productVersion')
#par2-sl from Macpar Deluxe 4.1 is only 10.6 and later
if int(os_version.split('.')[1]) >= 6:
sabnzbd.newsunpack.PAR2_COMMAND = check(curdir, 'osx/par2/par2-sl')
@ -1465,7 +1465,7 @@ def unrar_check(rar):
""" Return True if correct version of unrar is found """
if rar:
try:
version = subprocess.Popen(rar, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).stdout.read()
version = run_simple(rar)
except:
return False
m = re.search("RAR\s(\d+)\.(\d+)\s+.*Alexander Roshal", version)
@ -1629,3 +1629,13 @@ def get_from_url(url, timeout=None):
except:
output = None
return output
#------------------------------------------------------------------------------
def run_simple(cmd):
""" Run simple external command and return output
"""
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
txt = p.stdout.read()
p.wait()
return txt

Loading…
Cancel
Save