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

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/posix.py

CHANGE DETAILS

diff --git a/mercurial/posix.py b/mercurial/posix.py
--- a/mercurial/posix.py
+++ b/mercurial/posix.py
@@ -764,10 +764,14 @@
     # platforms (see sys/un.h)
     dirname, basename = os.path.split(path)
     bakwdfd = None
-    if dirname:
-        bakwdfd = os.open(b'.', os.O_DIRECTORY)
-        os.chdir(dirname)
-    sock.bind(basename)
-    if bakwdfd:
-        os.fchdir(bakwdfd)
-        os.close(bakwdfd)
+
+    try:
+        if dirname:
+            bakwdfd = os.open(b'.', os.O_DIRECTORY)
+            os.chdir(dirname)
+        sock.bind(basename)
+        if bakwdfd:
+            os.fchdir(bakwdfd)
+    finally:
+        if bakwdfd:
+            os.close(bakwdfd)



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to