dont cloes_fds if stdout/stderr is piped

This commit is contained in:
j 2016-01-31 18:55:12 +05:30
parent 591374d6d1
commit 7380c9aab7
2 changed files with 3 additions and 3 deletions

View file

@ -173,7 +173,7 @@ def info(pdf):
'''
cmd = ['pdfinfo', pdf]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
for line in stdout.strip().split('\n'):
parts = line.split(':')
@ -225,7 +225,7 @@ def extract_text(pdf):
cmd = ['/usr/bin/mdimport', '-d2', pdf]
else:
cmd = ['pdftotext', pdf, '-']
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
stdout = stdout.decode()
stderr = stderr.decode()

View file

@ -74,7 +74,7 @@ DirReqStatistics 0
cmd = [tor, '--defaults-torrc', defaults, '-f', torrc]
while self.running:
self.p = subprocess.Popen(cmd, stdout=subprocess.PIPE, bufsize=1,
universal_newlines=True, close_fds=True, start_new_session=True)
universal_newlines=True, start_new_session=True)
for line in self.p.stdout:
self._status.append(line)
logger.debug(line)