summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-12-16 15:11:18 -0500
committerColin Walters <walters@verbum.org>2010-12-16 15:11:18 -0500
commit865fef2e114faaf30a0d7c663eba824abfd4c484 (patch)
tree1af104cd805e53ac793adfcefcbee98dca3ebb80
parentc081e0287520c074387ba47dfb6cf59aaeef3663 (diff)
downloadhomegit-MOVED-TO-GNOME-865fef2e114faaf30a0d7c663eba824abfd4c484.zip
homegit-MOVED-TO-GNOME-865fef2e114faaf30a0d7c663eba824abfd4c484.tar.gz
homegit-MOVED-TO-GNOME-865fef2e114faaf30a0d7c663eba824abfd4c484.tar.xz
metabuild: Ensure we do a final read for tail
Otherwise we race, since the initial read was started, we'll get an empty buffer, and then if quit_data was set we'll exit. Do one final read after getting quit_data.
-rwxr-xr-xbin/metabuild9
1 files changed, 7 insertions, 2 deletions
diff --git a/bin/metabuild b/bin/metabuild
index 9043341..0d71ba4 100755
--- a/bin/metabuild
+++ b/bin/metabuild
@@ -72,6 +72,7 @@ class Tail(object):
self._mon = self._gfile.monitor(gio.FILE_MONITOR_NONE)
self._instream = self._gfile.read()
self._read_queued = False
+ self._final_read = False
self._quit_data = None
self._mon.connect('changed', self._on_changed)
@@ -88,8 +89,12 @@ class Tail(object):
self.output.write(buf)
self._do_read()
elif self._quit_data:
- self._quit_data[0].quit()
- self._quit_data[1]()
+ if self._final_read:
+ self._quit_data[0].quit()
+ self._quit_data[1]()
+ else:
+ self._final_read = True
+ self._do_read()
def _on_changed(self, mon, gfile, other, event):
self._do_read()