-
Notifications
You must be signed in to change notification settings - Fork 6
use pg-ctl stop to cleanup before killing the process #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
"""Set up a temporary postgres DB""" | ||
|
||
import itertools | ||
import os | ||
import sys | ||
|
@@ -358,6 +359,8 @@ def cleanup(self): | |
stdout=subprocess.DEVNULL, | ||
) | ||
elif self.pg_process: | ||
pg_stop_cmd = ['pg_ctl', 'stop', '-D', self.pg_data_dir, '-m' 'fast'] | ||
self.run_cmd(pg_stop_cmd, level=2, bg=True).wait() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think since run_cmd with level 2 can potentially produce stdout and stderr, instead of |
||
self.pg_process.kill() | ||
self.pg_process.wait() | ||
for d in [self.pg_temp_dir]: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to be able to override pg_ctl in the same way that we do postgres or initdb, in the case the user is using an alternative postgres install that is not in the PATH. This needs a default, and an argument (plus said default) in the constructor. See for example
DEFAULT_POSTGRES
orDEFAULT_INITDB