[PATCH 1 of 2] chgserver: add the setprocname interface

Jun Wu quark at fb.com
Wed Jan 11 01:13:09 UTC 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1484091408 -28800
#      Wed Jan 11 07:36:48 2017 +0800
# Node ID a82e9f172feff7ca2380b3db8833ddc64cd35429
# Parent  d3e2d39b97ea1f6654e50627a07fbd72d1a647a3
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r a82e9f172fef
chgserver: add the setprocname interface

This allows clients to change its process title freely.

diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -465,4 +465,12 @@ class chgcmdserver(commandserver.server)
                          'setumask': setumask})
 
+    if util.safehasattr(osutil, 'setprocname'):
+        def setprocname(self):
+            """Change process title"""
+            name = self._readstr()
+            _log('setprocname: %r\n' % name)
+            osutil.setprocname(name)
+        capabilities['setprocname'] = setprocname
+
 def _tempaddress(address):
     return '%s.%d.tmp' % (address, os.getpid())


More information about the Mercurial-devel mailing list