Patchwork [1,of,2] chgserver: add the setprocname interface

login
register
mail settings
Submitter Jun Wu
Date Jan. 11, 2017, 1:13 a.m.
Message ID <a82e9f172feff7ca2380.1484097189@x1c>
Download mbox | patch
Permalink /patch/18176/
State Accepted
Headers show

Comments

Jun Wu - Jan. 11, 2017, 1:13 a.m.
# HG changeset patch
# User Jun Wu <quark@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.

Patch

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