[PATCH 2 of 2] commandserver: close selector explicitly

Jun Wu quark at fb.com
Sun Jul 16 08:03:07 EDT 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1500205172 25200
#      Sun Jul 16 04:39:32 2017 -0700
# Node ID 638e9f6cccbc7d6f74c7e1ce551a3ee734970b62
# Parent  e9e6e076ffef9d11fa1f46201e85a3c4570a521a
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 638e9f6cccbc
commandserver: close selector explicitly

The selector does not have a __del__ method and needs a manual close. We can
also use "with selector" but that makes the code too indented. Therefore
append a "selector.close()" after the end of the main loop for now.

diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py
--- a/mercurial/commandserver.py
+++ b/mercurial/commandserver.py
@@ -513,4 +513,5 @@ class unixforkingservice(object):
                     finally:
                         os._exit(255)
+        selector.close()
 
     def _sigchldhandler(self, signal, frame):


More information about the Mercurial-devel mailing list