document: even better fix for std_index, which won't leave zombies

As in 342b1f32adacf0a, Popen processes need to be properly exited.

bzr revid: p_christ@hol.gr-20101223141744-bbuipsqwqb4wczb5
This commit is contained in:
P. Christeas 2010-12-23 16:17:44 +02:00
parent 8e8803e9df
commit f551479a9b
1 changed files with 6 additions and 4 deletions

View File

@ -95,8 +95,9 @@ class DocIndex(indexer):
return ['.doc']
def _doIndexFile(self,fname):
fp = Popen(['antiword', fname], shell=False, stdout=PIPE).stdout
return _to_unicode(fp.read())
pop = Popen(['antiword', fname], shell=False, stdout=PIPE)
(data, _) = pop.communicate()
return _to_unicode(data)
cntIndex.register(DocIndex())
@ -157,8 +158,9 @@ class PdfIndex(indexer):
return ['.pdf']
def _doIndexFile(self,fname):
fp = Popen(['pdftotext', '-enc', 'UTF-8', '-nopgbrk', fname, '-'], shell=False, stdout=PIPE).stdout
return _to_unicode( fp.read())
pop = Popen(['pdftotext', '-enc', 'UTF-8', '-nopgbrk', fname, '-'], shell=False, stdout=PIPE)
(data, _) = pop.communicate()
return _to_unicode(data)
cntIndex.register(PdfIndex())