Changeset

5794:66c3ad5d29ad

util.async: Fix logic bug that prevented error watcher being called for runners
author Matthew Wild <mwild1@gmail.com>
date Tue, 13 Aug 2013 19:23:00 +0100
parents 5793:e8c79796ead9
children 5795:47c2f71d8314
files util/async.lua
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/util/async.lua	Mon Aug 12 13:22:27 2013 +0200
+++ b/util/async.lua	Tue Aug 13 19:23:00 2013 +0100
@@ -103,8 +103,12 @@
 		n = #q;
 	end
 	self.state = state;
-	if state ~= self.notified_state then
-		self.notified_state = state;
+	if err or state ~= self.notified_state then
+		if err then
+			state = "error"
+		else
+			self.notified_state = state;
+		end
 		local handler = self.watchers[state];
 		if handler then handler(self, err); end
 	end