chgserver: add the setprocname interface
authorJun Wu <quark@fb.com>
Wed, 11 Jan 2017 07:36:48 +0800
changeset 30750 378686afca52
parent 30749 e38e7ea21987
child 30751 e882c7bb5a0b
chgserver: add the setprocname interface This allows clients to change its process title freely.
mercurial/chgserver.py
--- a/mercurial/chgserver.py	Tue Jan 10 23:41:58 2017 +0800
+++ b/mercurial/chgserver.py	Wed Jan 11 07:36:48 2017 +0800
@@ -464,6 +464,14 @@
                          'setenv': setenv,
                          '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())