[devtools] set PGPORT/PGHOST when calling pg_ctl start
authorJulien Cristau <julien.cristau@logilab.fr>
Thu, 10 Apr 2014 13:54:31 +0200
changeset 9679 a3a516cf8624
parent 9677 f0130c270793
child 9680 8fb8f001f4e2
[devtools] set PGPORT/PGHOST when calling pg_ctl start Helps pg_ctl find the socket on squeeze, otherwise it looks in /var/run/postgresql.
devtools/__init__.py
--- a/devtools/__init__.py	Thu Apr 10 10:59:08 2014 +0200
+++ b/devtools/__init__.py	Thu Apr 10 13:54:31 2014 +0200
@@ -548,7 +548,12 @@
         if not exists(datadir):
             subprocess.check_call(['initdb', '-D', datadir, '-E', 'utf-8', '--locale=C'])
         port = self.system_source['db-port']
-        subprocess.check_call(['pg_ctl', 'start', '-w', '-D', datadir, '-o', '-h "" -k /tmp -p %s' % port])
+        directory = self.system_source['db-host']
+        env = os.environ.copy()
+        env['PGPORT'] = str(port)
+        env['PGHOST'] = str(directory)
+        subprocess.check_call(['pg_ctl', 'start', '-w', '-D', datadir, '-o', '-h "" -k %s -p %s' % (directory, port)],
+                              env=env)
         self.__CTL.add(datadir)
 
     @property