Commits

TakUnity committed 0767d20

Write master process id to socketpath.pid.

Comments (0)

Files changed (1)

hgext/chgsupport.py

 
         self._workerpids = []
         master = self._maxworkers > 0
+        
+        # Write master pid to sockpath.pid
+        try:
+            if master:
+                f = open(('%s.pid' % self._sockpath), 'w')
+                f.write('%d' % os.getpid())
+                f.close()
+        except:
+            self._ui.debug('error writing pid to %s.pid\n' % self._sockpath)
+                    
         try:
             try:
                 while master:
             self._sock.close()
             if master or self._maxworkers <= 0:
                 os.unlink(self._sockpath)
+                os.unlink('%s.pid' % self._sockpath)
 
     def _servemaster(self):
         for _i in xrange(self._maxworkers - len(self._workerpids)):