[PATCH] debugwireproto: handle unimplemented util.poll() for Windows

Matt Harbison mharbison72 at gmail.com
Tue Mar 6 01:48:29 UTC 2018


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1520299354 18000
#      Mon Mar 05 20:22:34 2018 -0500
# Node ID 7a25f6cfebe80802321d2975b97fc15ec38cf8ec
# Parent  2aff6daf779098eee4c350ccd0197dcc2231e197
debugwireproto: handle unimplemented util.poll() for Windows

This is the same logic used in sshpeer.doublepipe.  It doesn't completely fix
test-ssh-proto{,-unbundle}.t ("read(-1) -> X" is changed to "read(X) -> X", the
order of some lines are changed, and abort messages seem to be missing), but it
cuts down a ton on the failure spew.

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -2818,11 +2818,16 @@
         elif action == 'close':
             peer.close()
         elif action == 'readavailable':
-            fds = util.poll([stdout.fileno(), stderr.fileno()])
-
-            if stdout.fileno() in fds:
+            fds = [stdout.fileno(), stderr.fileno()]
+            try:
+                act = util.poll(fds)
+            except NotImplementedError:
+                # non supported yet case, assume all have data.
+                act = fds
+
+            if stdout.fileno() in act:
                 util.readpipe(stdout)
-            if stderr.fileno() in fds:
+            if stderr.fileno() in act:
                 util.readpipe(stderr)
         elif action == 'readline':
             stdout.readline()


More information about the Mercurial-devel mailing list