Skip to content

Commit 0e5533f

Browse files
committed
CI: Improve layer shutdown behaviour
1 parent 2a73fdd commit 0e5533f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/crate/testing/layer.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,17 @@ def start(self):
326326

327327
def stop(self):
328328
if self.process:
329-
self.process.terminate()
330329
try:
331330
self.process.communicate(timeout=10)
332331
except subprocess.TimeoutExpired:
333332
# On GHA/Windows, it always runs into a timeout, even after 45 seconds.
334-
pass
333+
#
334+
# The child process is not killed if the timeout expires, so in order
335+
# to cleanup properly a well-behaved application should kill the child
336+
# process and finish communication.
337+
# https://docs.python.org/3/library/subprocess.html#subprocess.Popen.communicate
338+
self.process.kill()
339+
self.process.communicate()
335340
self.process.stdout.close()
336341
self.process = None
337342
self.conn_pool.clear()

0 commit comments

Comments
 (0)