Browse Source

newsunpack -> run_simple(): solves ResourceWarning: unclosed file on Popen()

pull/1408/head
Sander Jonkers 5 years ago
committed by Safihre
parent
commit
e71bd8370d
  1. 6
      sabnzbd/newsunpack.py

6
sabnzbd/newsunpack.py

@ -2406,7 +2406,7 @@ class SevenZip:
def run_simple(cmd):
""" Run simple external command and return output """
p = Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
txt = platform_btou(p.stdout.read())
p.wait()
with Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as p:
txt = platform_btou(p.stdout.read())
p.wait()
return txt

Loading…
Cancel
Save