--- a/mercurial/cmdutil.py Fri Dec 04 17:43:01 2009 +0100
+++ b/mercurial/cmdutil.py Tue Dec 01 11:28:31 2009 +0900
@@ -558,7 +558,7 @@
return errors
def service(opts, parentfn=None, initfn=None, runfn=None, logfile=None,
- runargs=None):
+ runargs=None, appendpid=False):
'''Run a command as a service.'''
if opts['daemon'] and not opts['daemon_pipefds']:
@@ -588,7 +588,8 @@
initfn()
if opts['pid_file']:
- fp = open(opts['pid_file'], 'w')
+ mode = appendpid and 'a' or 'w'
+ fp = open(opts['pid_file'], mode)
fp.write(str(os.getpid()) + '\n')
fp.close()