devtools/__init__.py
changeset 10796 26a36c2a5fbd
parent 10671 e08102f45237
child 10819 5b5864483c4d
--- 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):