dont cloes_fds if stdout/stderr is piped
This commit is contained in:
parent
591374d6d1
commit
7380c9aab7
2 changed files with 3 additions and 3 deletions
|
@ -173,7 +173,7 @@ def info(pdf):
|
||||||
|
|
||||||
'''
|
'''
|
||||||
cmd = ['pdfinfo', 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()
|
stdout, stderr = p.communicate()
|
||||||
for line in stdout.strip().split('\n'):
|
for line in stdout.strip().split('\n'):
|
||||||
parts = line.split(':')
|
parts = line.split(':')
|
||||||
|
@ -225,7 +225,7 @@ def extract_text(pdf):
|
||||||
cmd = ['/usr/bin/mdimport', '-d2', pdf]
|
cmd = ['/usr/bin/mdimport', '-d2', pdf]
|
||||||
else:
|
else:
|
||||||
cmd = ['pdftotext', pdf, '-']
|
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, stderr = p.communicate()
|
||||||
stdout = stdout.decode()
|
stdout = stdout.decode()
|
||||||
stderr = stderr.decode()
|
stderr = stderr.decode()
|
||||||
|
|
|
@ -74,7 +74,7 @@ DirReqStatistics 0
|
||||||
cmd = [tor, '--defaults-torrc', defaults, '-f', torrc]
|
cmd = [tor, '--defaults-torrc', defaults, '-f', torrc]
|
||||||
while self.running:
|
while self.running:
|
||||||
self.p = subprocess.Popen(cmd, stdout=subprocess.PIPE, bufsize=1,
|
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:
|
for line in self.p.stdout:
|
||||||
self._status.append(line)
|
self._status.append(line)
|
||||||
logger.debug(line)
|
logger.debug(line)
|
||||||
|
|
Loading…
Reference in a new issue