Skip to content

Commit f055454

Browse files
committed
use pg-ctl stop to cleanup before killing the process
1 parent 766320c commit f055454

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pg_temp/pg_temp.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Set up a temporary postgres DB"""
2+
23
import itertools
34
import os
45
import sys
@@ -358,6 +359,8 @@ def cleanup(self):
358359
stdout=subprocess.DEVNULL,
359360
)
360361
elif self.pg_process:
362+
pg_stop_cmd = ['pg_ctl', 'stop', '-D', self.pg_data_dir, '-m' 'fast']
363+
self.run_cmd(pg_stop_cmd, level=2, bg=True).wait()
361364
self.pg_process.kill()
362365
self.pg_process.wait()
363366
for d in [self.pg_temp_dir]:

0 commit comments

Comments
 (0)