util.async: Fix logic bug that prevented error watcher being called for runners
authorMatthew Wild <mwild1@gmail.com>
Tue, 13 Aug 2013 18:23:00 +0000 (19:23 +0100)
committerMatthew Wild <mwild1@gmail.com>
Tue, 13 Aug 2013 18:23:00 +0000 (19:23 +0100)
util/async.lua

index d0bc6c3d6f5fe8c849f9e254cc10691562aae726..8af8730f891d0b7ee648e96c7b477f9818a6e9fd 100644 (file)
@@ -103,8 +103,12 @@ function runner_mt:run(input)
                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