1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

lvmdbusd: Only read whats buffered

When reading data from stdout & stderr we were reading until the
reading until we got None back which really isn't needed as the
read will return everything that is available.
This commit is contained in:
Tony Asleson 2016-11-23 14:49:23 -06:00
parent a7404b5b83
commit 064e24bc1e

View File

@ -64,13 +64,9 @@ class LVMShellProxy(object):
for r in ready[0]: for r in ready[0]:
if r == self.lvm_shell.stdout.fileno(): if r == self.lvm_shell.stdout.fileno():
while True: tmp = self.lvm_shell.stdout.read()
tmp = self.lvm_shell.stdout.read() if tmp:
if tmp: stdout += tmp.decode("utf-8")
stdout += tmp.decode("utf-8")
else:
break
elif r == self.report_r: elif r == self.report_r:
while True: while True:
tmp = os.read(self.report_r, 16384) tmp = os.read(self.report_r, 16384)
@ -82,12 +78,9 @@ class LVMShellProxy(object):
break break
elif r == self.lvm_shell.stderr.fileno(): elif r == self.lvm_shell.stderr.fileno():
while True: tmp = self.lvm_shell.stderr.read()
tmp = self.lvm_shell.stderr.read() if tmp:
if tmp: stderr += tmp.decode("utf-8")
stderr += tmp.decode("utf-8")
else:
break
# Check to see if the lvm process died on us # Check to see if the lvm process died on us
if self.lvm_shell.poll(): if self.lvm_shell.poll():