blob: a57716c676143d637d26a73e86007d7435a8e9af (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
$NetBSD: patch-mcomix_archive_pdf_external.py,v 1.1 2016/12/03 04:08:53 nonaka Exp $
fix read subprocess stdout line by line.
See http://stackoverflow.com/questions/2715847/python-read-streaming-input-from-subprocess-communicate/17698359#17698359
--- mcomix/archive/pdf_external.py.orig 2016-02-12 18:52:12.000000000 +0000
+++ mcomix/archive/pdf_external.py 2016-12-03 03:47:31.069776589 +0000
@@ -34,7 +34,7 @@ class PdfArchive(archive_base.BaseArchiv
def iter_contents(self):
proc = process.popen(_mutool_exec + ['show', '--', self.archive, 'pages'])
try:
- for line in proc.stdout:
+ for line in iter(proc.stdout.readline, b''):
if line.startswith('page '):
yield line.split()[1] + '.png'
finally:
@@ -52,7 +52,7 @@ class PdfArchive(archive_base.BaseArchiv
try:
max_size = 0
max_dpi = PDF_RENDER_DPI_DEF
- for line in proc.stdout:
+ for line in iter(proc.stdout.readline, b''):
match = self._fill_image_regex.match(line)
if not match:
continue
|