# HG changeset patch # User Nicolas Dumazet # Date 1259634511 -32400 # Node ID 2bfe1a23dafa31701ce1946ba339480d8a5b1fdd # Parent a9836feb5a8cec57d4ac30583d6637a3b219da87 cmdutil: service: add appendpid parameter to append pids to pid file diff -r a9836feb5a8c -r 2bfe1a23dafa mercurial/cmdutil.py --- 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()