Mercurial > hg
changeset 10012:2bfe1a23dafa
cmdutil: service: add appendpid parameter to append pids to pid file
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Tue, 01 Dec 2009 11:28:31 +0900 |
parents | a9836feb5a8c |
children | b2e87fde6806 |
files | mercurial/cmdutil.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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()