##// END OF EJS Templates
cmdutil.service: move pidfile writing to a local function...
Siddharth Agarwal -
r19867:edce20eb default
parent child Browse files
Show More
@@ -468,6 +468,13 b' def service(opts, parentfn=None, initfn='
468 468 runargs=None, appendpid=False):
469 469 '''Run a command as a service.'''
470 470
471 def writepid(pid):
472 if opts['pid_file']:
473 mode = appendpid and 'a' or 'w'
474 fp = open(opts['pid_file'], mode)
475 fp.write(str(pid) + '\n')
476 fp.close()
477
471 478 if opts['daemon'] and not opts['daemon_pipefds']:
472 479 # Signal child process startup with file removal
473 480 lockfd, lockpath = tempfile.mkstemp(prefix='hg-service-')
@@ -504,11 +511,7 b' def service(opts, parentfn=None, initfn='
504 511 if initfn:
505 512 initfn()
506 513
507 if opts['pid_file']:
508 mode = appendpid and 'a' or 'w'
509 fp = open(opts['pid_file'], mode)
510 fp.write(str(os.getpid()) + '\n')
511 fp.close()
514 writepid(os.getpid())
512 515
513 516 if opts['daemon_pipefds']:
514 517 lockpath = opts['daemon_pipefds']
General Comments 0
You need to be logged in to leave comments. Login now