Patchwork [2,of,2] commandserver: close selector explicitly

login
register
mail settings
Submitter Jun Wu
Date July 16, 2017, 12:03 p.m.
Message ID <638e9f6cccbc7d6f74c7.1500206587@x1c>
Download mbox | patch
Permalink /patch/22436/
State Accepted
Headers show

Comments

Jun Wu - July 16, 2017, 12:03 p.m.
# HG changeset patch
# User Jun Wu <quark@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.
Yuya Nishihara - July 16, 2017, 2:19 p.m.
On Sun, 16 Jul 2017 05:03:07 -0700, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark@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

Queued this, thanks.

Patch

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):