mercurial/cmdutil.py
changeset 19868 0532c8f8e911
parent 19867 edce20ebe1f3
child 19894 df91e2df6ba3
--- a/mercurial/cmdutil.py	Wed Oct 02 15:17:50 2013 -0700
+++ b/mercurial/cmdutil.py	Wed Oct 02 15:20:49 2013 -0700
@@ -497,6 +497,7 @@
             pid = util.rundetached(runargs, condfn)
             if pid < 0:
                 raise util.Abort(_('child process failed to start'))
+            writepid(pid)
         finally:
             try:
                 os.unlink(lockpath)
@@ -511,7 +512,8 @@
     if initfn:
         initfn()
 
-    writepid(os.getpid())
+    if not opts['daemon']:
+        writepid(os.getpid())
 
     if opts['daemon_pipefds']:
         lockpath = opts['daemon_pipefds']