summaryrefslogtreecommitdiff
path: root/graphics/py-mcomix/patches/patch-mcomix_archive_sevenzip_external.py
blob: c7d835a2ee177e1db166ac7f306b37b20b9935ee (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_sevenzip_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/sevenzip_external.py.orig	2016-02-12 18:52:12.000000000 +0000
+++ mcomix/archive/sevenzip_external.py	2016-12-03 03:47:59.108184817 +0000
@@ -112,7 +112,7 @@ class SevenZipArchive(archive_base.Exter
             self._path = None
             proc = process.popen(self._get_list_arguments(), stderr=process.STDOUT)
             try:
-                for line in proc.stdout:
+                for line in iter(proc.stdout.readline, b''):
                     filename = self._parse_list_output_line(line.rstrip(os.linesep))
                     if filename is not None:
                         yield self._unicode_filename(filename)
@@ -231,7 +231,7 @@ class TarArchive(SevenZipArchive):
         self._path = 'archive.tar'
         proc = process.popen(self._get_list_arguments(), stderr=process.STDOUT)
         try:
-            for line in proc.stdout:
+            for line in iter(proc.stdout.readline, b''):
                 self._parse_list_output_line(line.rstrip(os.linesep))
         finally:
             proc.stdout.close()