##// END OF EJS Templates
util: enable getpid to be replaced...
timeless -
r28027:14033c5d default
parent child Browse files
Show More
@@ -31,7 +31,7 b' Examples::'
31
31
32 from mercurial import util, cmdutil
32 from mercurial import util, cmdutil
33 from mercurial.i18n import _
33 from mercurial.i18n import _
34 import errno, os, re
34 import errno, re
35
35
36 cmdtable = {}
36 cmdtable = {}
37 command = cmdutil.command(cmdtable)
37 command = cmdutil.command(cmdtable)
@@ -107,7 +107,7 b' def wrapui(ui):'
107 if blackbox:
107 if blackbox:
108 date = util.datestr(None, '%Y/%m/%d %H:%M:%S')
108 date = util.datestr(None, '%Y/%m/%d %H:%M:%S')
109 user = util.getuser()
109 user = util.getuser()
110 pid = str(os.getpid())
110 pid = str(util.getpid())
111 formattedmsg = msg[0] % msg[1:]
111 formattedmsg = msg[0] % msg[1:]
112 try:
112 try:
113 blackbox.write('%s %s (%s)> %s' %
113 blackbox.write('%s %s (%s)> %s' %
@@ -796,7 +796,7 b' def service(opts, parentfn=None, initfn='
796 initfn()
796 initfn()
797
797
798 if not opts['daemon']:
798 if not opts['daemon']:
799 writepid(os.getpid())
799 writepid(util.getpid())
800
800
801 if opts['daemon_pipefds']:
801 if opts['daemon_pipefds']:
802 lockpath = opts['daemon_pipefds']
802 lockpath = opts['daemon_pipefds']
@@ -262,7 +262,7 b' class server(object):'
262 hellomsg += '\n'
262 hellomsg += '\n'
263 hellomsg += 'encoding: ' + encoding.encoding
263 hellomsg += 'encoding: ' + encoding.encoding
264 hellomsg += '\n'
264 hellomsg += '\n'
265 hellomsg += 'pid: %d' % os.getpid()
265 hellomsg += 'pid: %d' % util.getpid()
266
266
267 # write the hello msg in -one- chunk
267 # write the hello msg in -one- chunk
268 self.cout.write(hellomsg)
268 self.cout.write(hellomsg)
@@ -9,7 +9,6 b' from __future__ import absolute_import'
9
9
10 import contextlib
10 import contextlib
11 import errno
11 import errno
12 import os
13 import socket
12 import socket
14 import time
13 import time
15 import warnings
14 import warnings
@@ -77,8 +76,8 b' class lock(object):'
77 self.release()
76 self.release()
78
77
79 def _getpid(self):
78 def _getpid(self):
80 # wrapper around os.getpid() to make testing easier
79 # wrapper around util.getpid() to make testing easier
81 return os.getpid()
80 return util.getpid()
82
81
83 def lock(self):
82 def lock(self):
84 timeout = self.timeout
83 timeout = self.timeout
@@ -65,6 +65,7 b' explainexit = platform.explainexit'
65 findexe = platform.findexe
65 findexe = platform.findexe
66 gethgcmd = platform.gethgcmd
66 gethgcmd = platform.gethgcmd
67 getuser = platform.getuser
67 getuser = platform.getuser
68 getpid = os.getpid
68 groupmembers = platform.groupmembers
69 groupmembers = platform.groupmembers
69 groupname = platform.groupname
70 groupname = platform.groupname
70 hidewindow = platform.hidewindow
71 hidewindow = platform.hidewindow
@@ -28,7 +28,7 b' class lockwrapper(lock.lock):'
28 self._pidoffset = pidoffset
28 self._pidoffset = pidoffset
29 super(lockwrapper, self).__init__(*args, **kwargs)
29 super(lockwrapper, self).__init__(*args, **kwargs)
30 def _getpid(self):
30 def _getpid(self):
31 return os.getpid() + self._pidoffset
31 return super(lockwrapper, self)._getpid() + self._pidoffset
32
32
33 class teststate(object):
33 class teststate(object):
34 def __init__(self, testcase, dir, pidoffset=0):
34 def __init__(self, testcase, dir, pidoffset=0):
General Comments 0
You need to be logged in to leave comments. Login now