equal
deleted
inserted
replaced
495 def condfn(): |
495 def condfn(): |
496 return not os.path.exists(lockpath) |
496 return not os.path.exists(lockpath) |
497 pid = util.rundetached(runargs, condfn) |
497 pid = util.rundetached(runargs, condfn) |
498 if pid < 0: |
498 if pid < 0: |
499 raise util.Abort(_('child process failed to start')) |
499 raise util.Abort(_('child process failed to start')) |
|
500 writepid(pid) |
500 finally: |
501 finally: |
501 try: |
502 try: |
502 os.unlink(lockpath) |
503 os.unlink(lockpath) |
503 except OSError, e: |
504 except OSError, e: |
504 if e.errno != errno.ENOENT: |
505 if e.errno != errno.ENOENT: |
509 return |
510 return |
510 |
511 |
511 if initfn: |
512 if initfn: |
512 initfn() |
513 initfn() |
513 |
514 |
514 writepid(os.getpid()) |
515 if not opts['daemon']: |
|
516 writepid(os.getpid()) |
515 |
517 |
516 if opts['daemon_pipefds']: |
518 if opts['daemon_pipefds']: |
517 lockpath = opts['daemon_pipefds'] |
519 lockpath = opts['daemon_pipefds'] |
518 try: |
520 try: |
519 os.setsid() |
521 os.setsid() |