[meld/VersionControlRework: 111/123] misc, vcview: Tidy up our iterable pipe handling slightly
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld/VersionControlRework: 111/123] misc, vcview: Tidy up our iterable pipe handling slightly
- Date: Sun, 19 Apr 2015 20:15:20 +0000 (UTC)
commit 739c5d4af93c990c80190463536ea298cb392a69
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Apr 18 09:16:18 2015 +1000
misc, vcview: Tidy up our iterable pipe handling slightly
meld/misc.py | 3 +--
meld/vcview.py | 14 +++++++-------
2 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/meld/misc.py b/meld/misc.py
index a7160e4..33b29f8 100644
--- a/meld/misc.py
+++ b/meld/misc.py
@@ -231,8 +231,7 @@ def read_pipe_iter(command, workdir, errorstream, yield_interval=0.1):
self.proc = None
if status:
errorstream.error("Exit code: %i\n" % status)
- yield "".join(bits)
- yield status
+ yield status, "".join(bits)
return sentinel()()
diff --git a/meld/vcview.py b/meld/vcview.py
index a9b2754..7a55f0c 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -574,30 +574,30 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
return " ".join(quote(tok) for tok in command)
files = [os.path.relpath(f, working_dir) for f in files]
- r = None
msg = shelljoin(command + files) + " (in %s)\n" % working_dir
self.consolestream.command(msg)
readiter = misc.read_pipe_iter(
command + files, workdir=working_dir,
errorstream=self.consolestream)
try:
- while r is None:
- r = next(readiter)
- self.consolestream.output(r)
+ result = next(readiter)
+ while not result:
yield 1
+ result = next(readiter)
except IOError as err:
misc.error_dialog(
"Error running command",
"While running '%s'\nError: %s" % (msg, err))
- self.consolestream.output("\n")
+ result = (1, "")
+
+ returncode, output = result
+ self.consolestream.output(output + "\n")
- returncode = next(readiter)
if returncode:
self.console_vbox.show()
if refresh:
self.refresh_partial(working_dir)
- yield working_dir, r
def has_command(self, command):
vc_command = self.command_map.get(command)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]