Patchwork [1,of,4] inotify: add pidfile to parent options

login
register
mail settings
Submitter Siddharth Agarwal
Date Oct. 2, 2013, 11:19 p.m.
Message ID <63a4ad5b170b08c5b1b3.1380755983@dev1091.prn1.facebook.com>
Download mbox | patch
Permalink /patch/2713/
State Accepted
Commit 993b2448867994252aebdc0ed04e69572d57e811
Headers show

Comments

Siddharth Agarwal - Oct. 2, 2013, 11:19 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1380748826 25200
#      Wed Oct 02 14:20:26 2013 -0700
# Node ID 63a4ad5b170b08c5b1b33b992710c3da3b518b16
# Parent  35400b87043aefd7fea1d8b29059172c6d63130e
inotify: add pidfile to parent options

An upcoming patch will move pidfile writing from the parent to the child. This
means that if the pid file isn't specified on the command-line but is specified
as a config option, it needs to be added to the parent's opts dict.

Patch

diff --git a/hgext/inotify/server.py b/hgext/inotify/server.py
--- a/hgext/inotify/server.py
+++ b/hgext/inotify/server.py
@@ -451,7 +451,9 @@ 
         runargs = util.hgcmd() + sys.argv[1:]
 
     pidfile = ui.config('inotify', 'pidfile')
-    if opts['daemon'] and pidfile is not None and 'pid-file' not in runargs:
+    opts.setdefault('pid_file', '')
+    if opts['daemon'] and pidfile is not None and not opts['pid_file']:
+        opts['pid_file'] = pidfile
         runargs.append("--pid-file=%s" % pidfile)
 
     service = service()