mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-29 02:12:36 +02:00
Improve EOF detection when reading command output
Do not read a line from the command output and then check if
we are at EOF, because it's possible that the writer immediately exited
after writing the last line of output. Instead, switch the order of
actions.
This is a very serious bug that can lead to Dangerzone excluding the
last page of the document. It should have bit us right from the start
(see aeeed411a0
), but it seems that the
small period of time it takes the kernel to close the file descriptors
was hiding this bug.
Fixes #560
This commit is contained in:
parent
79c1d6db0f
commit
6012cd1491
1 changed files with 1 additions and 3 deletions
|
@ -63,10 +63,8 @@ class DangerzoneConverter:
|
|||
if they know its encoding.
|
||||
"""
|
||||
buf = b""
|
||||
while True:
|
||||
while not sr.at_eof():
|
||||
line = await sr.readline()
|
||||
if sr.at_eof():
|
||||
break
|
||||
self.captured_output += line
|
||||
if callback is not None:
|
||||
callback(line)
|
||||
|
|
Loading…
Reference in a new issue