Skip to content

Commit 59fe76a

Browse files
author
Geert Vanderkelen
committed
BUG18814880: Fix stopping mysqld running unit tests on Windows
The error "Procedure probably called with not enough arguments" occurs when calling the winkernel.WaitForSingleObject() without the timeout argument. We fix this by refactoring process_terminate() function in the test.mysqld module and not use WaitForSingleObject any longer.
1 parent 67883f8 commit 59fe76a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tests/mysqld.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,16 @@ def process_running(pid):
109109
def process_terminate(pid):
110110
"""Terminates a process
111111
112-
This function terminates a running process, sending a SIGKILL on
113-
Posix systems and using ctypes.windll on Windows.
112+
This function terminates a running process using it's pid (process
113+
ID), sending a SIGKILL on Posix systems and using ctypes.windll
114+
on Windows.
115+
116+
Raises MySQLServerError on errors.
114117
"""
115118
if os.name == 'nt':
116119
winkernel = ctypes.windll.kernel32
117-
process = winkernel.OpenProcess(1, 0, pid)
118-
winkernel.TerminateProcess(process, -1)
119-
winkernel.WaitForSingleObject(process)
120+
process = winkernel.OpenProcess(0x0001, 0, pid) # PROCESS_TERMINATE
121+
winkernel.TerminateProcess(process, 1)
120122
winkernel.CloseHandle(process)
121123
else:
122124
os.kill(pid, signal.SIGTERM)

0 commit comments

Comments
 (0)