diff -r 5d0c0c8d2929 -r 27d23fe32887 mercurial/commandserver.py --- a/mercurial/commandserver.py Fri Jul 14 20:19:46 2017 -0700 +++ b/mercurial/commandserver.py Fri Jul 14 20:26:21 2017 -0700 @@ -22,6 +22,7 @@ encoding, error, pycompat, + selectors2, util, ) @@ -476,6 +477,8 @@ def _mainloop(self): exiting = False h = self._servicehandler + selector = selectors2.DefaultSelector() + selector.register(self._sock, selectors2.EVENT_READ) while True: if not exiting and h.shouldexit(): # clients can no longer connect() to the domain socket, so @@ -486,7 +489,7 @@ self._unlinksocket() exiting = True try: - ready = select.select([self._sock], [], [], h.pollinterval)[0] + ready = selector.select(timeout=h.pollinterval) if not ready: # only exit if we completed all queued requests if exiting: