changeset 36741:7a25f6cfebe8

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.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 05 Mar 2018 20:22:34 -0500
parents 2aff6daf7790
children 424994a0adfd
files mercurial/debugcommands.py
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Sun Mar 04 16:55:51 2018 -0500
+++ b/mercurial/debugcommands.py	Mon Mar 05 20:22:34 2018 -0500
@@ -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()