[Request] [+ ] D9816: run-tests: catch a Windows specific error when testing for a free socket

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Mon Jan 18 06:45:45 UTC 2021


mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I'm not sure why this only happens with py3, but this error code doesn't map to
  any of the 3 currently being handled, and kills `run-tests.py` before it can run
  any tests when it happens:
  
    OSError: [WinError 10013] An attempt was made to access a socket in a way
    forbidden by its access permissions
  
  The documentation[1] says this can happen if another process is bound to the
  address with exclusive access.  This seems to keep it happy.
  
  [1] https://docs.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9816

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -260,7 +260,9 @@
             s.bind(('localhost', port))
         return True
     except socket.error as exc:
-        if exc.errno not in (
+        if os.name == 'nt' and exc.errno == errno.WSAEACCES:
+            return False
+        elif exc.errno not in (
             errno.EADDRINUSE,
             errno.EADDRNOTAVAIL,
             errno.EPROTONOSUPPORT,



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210118/f7c0e39c/attachment-0001.html>


More information about the Mercurial-patches mailing list