[devtools] delete postgresql socket directory after killing the server
... or when failing to start it.
--- a/devtools/__init__.py Mon Jul 27 10:13:25 2015 +0200
+++ b/devtools/__init__.py Fri Oct 16 16:44:36 2015 +0200
@@ -564,6 +564,10 @@
'-o', options],
env=env)
except OSError as err:
+ try:
+ os.rmdir(sockdir)
+ except OSError:
+ pass
if err.errno == errno.ENOENT:
raise OSError('"pg_ctl" could not be found. '
'You should add the postgresql bin folder to your PATH '
@@ -576,6 +580,10 @@
datadir = join(os.path.dirname(pyfile), 'data',
'pgdb-%s' % os.path.splitext(os.path.basename(pyfile))[0])
subprocess.call(['pg_ctl', 'stop', '-D', datadir, '-m', 'fast'])
+ try:
+ os.rmdir(DEFAULT_PSQL_SOURCES['system']['db-host'])
+ except OSError:
+ pass
class PostgresTestDataBaseHandler(TestDataBaseHandler):