diff --git a/gerritlib/gerrit.py b/gerritlib/gerrit.py index 0089bc9..3d78fca 100644 --- a/gerritlib/gerrit.py +++ b/gerritlib/gerrit.py @@ -15,6 +15,7 @@ import json import logging +import platform import pprint import select import six.moves @@ -34,6 +35,7 @@ UPDATE_ALLOWED_KEYS = ['description', 'submit-type', 'content-merge', 'change-id', 'project-state', 'max-object-size-limit'] +IS_LINUX = platform.system() == "Linux" class GerritConnection(object): @@ -148,10 +150,13 @@ class GerritWatcher(threading.Thread): ret = poll.poll() for (fd, event) in ret: if fd == stdout.channel.fileno(): - if event == select.POLLIN: + # event is a bitmask + # On Darwin non-critical OOB messages can be received + if (IS_LINUX and event == select.POLLIN) or \ + (not IS_LINUX and event & select.POLLIN): self._read(stdout) else: - raise Exception("event on ssh connection") + raise Exception("event %s on ssh connection" % event) def _consume(self, client): """Consumes events using the given client."""