Patchwork [3,of,4] chgserver: add the setprocname interface

login
register
mail settings
Submitter Jun Wu
Date Aug. 10, 2016, 5:29 p.m.
Message ID <7472b38c08ca30af7466.1470850199@x1c>
Download mbox | patch
Permalink /patch/16246/
State Changes Requested
Headers show

Comments

Jun Wu - Aug. 10, 2016, 5:29 p.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1470847598 -3600
#      Wed Aug 10 17:46:38 2016 +0100
# Node ID 7472b38c08ca30af74668f41056afbd065887c04
# Parent  6913c4d46efa50511191c3c310882602d07cc305
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 7472b38c08ca
chgserver: add the setprocname interface

This allows clients to change its process title freely.

Patch

diff --git a/hgext/chgserver.py b/hgext/chgserver.py
--- a/hgext/chgserver.py
+++ b/hgext/chgserver.py
@@ -529,6 +529,14 @@  class chgcmdserver(commandserver.server)
                          '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())