Skip to content

Commit 318c537

Browse files
committed
CI: Improve layer shutdown behaviour
1 parent 24605cc commit 318c537

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/crate/testing/layer.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,17 @@ def start(self):
323323

324324
def stop(self):
325325
if self.process:
326-
self.process.terminate()
327326
try:
328327
self.process.communicate(timeout=10)
329328
except subprocess.TimeoutExpired:
330329
# On GHA/Windows, it always runs into a timeout, even after 45 seconds.
331-
pass
330+
#
331+
# The child process is not killed if the timeout expires, so in order
332+
# to cleanup properly a well-behaved application should kill the child
333+
# process and finish communication.
334+
# https://docs.python.org/3/library/subprocess.html#subprocess.Popen.communicate
335+
self.process.kill()
336+
self.process.communicate()
332337
self.process.stdout.close()
333338
self.process = None
334339
self.conn_pool.clear()

0 commit comments

Comments
 (0)