Fixed ResourceWarning in MySQL's _clone_test_db().
This commit is contained in:
parent
d4fc111c24
commit
c37b844349
|
@ -66,7 +66,7 @@ class DatabaseCreation(BaseDatabaseCreation):
|
||||||
load_cmd = DatabaseClient.settings_to_cmd_args(self.connection.settings_dict)
|
load_cmd = DatabaseClient.settings_to_cmd_args(self.connection.settings_dict)
|
||||||
load_cmd[-1] = target_database_name
|
load_cmd[-1] = target_database_name
|
||||||
|
|
||||||
dump_proc = subprocess.Popen(dump_cmd, stdout=subprocess.PIPE)
|
with subprocess.Popen(dump_cmd, stdout=subprocess.PIPE) as dump_proc:
|
||||||
load_proc = subprocess.Popen(load_cmd, stdin=dump_proc.stdout, stdout=subprocess.PIPE)
|
with subprocess.Popen(load_cmd, stdin=dump_proc.stdout, stdout=subprocess.DEVNULL):
|
||||||
dump_proc.stdout.close() # allow dump_proc to receive a SIGPIPE if load_proc exits.
|
# Allow dump_proc to receive a SIGPIPE if the load process exits.
|
||||||
load_proc.communicate()
|
dump_proc.stdout.close()
|
||||||
|
|
Loading…
Reference in New Issue