Get kill_remote() to work in shared Microsoft Windows build
commit80c42732f8e503fdf550dc0679524560569db3ad
authorOlly Betts <olly@survex.com>
Mon, 16 Dec 2024 03:46:18 +0000 (16 16:46 +1300)
committerOlly Betts <olly@survex.com>
Mon, 16 Dec 2024 03:46:18 +0000 (16 16:46 +1300)
tree7871fe3a6db83afa67ffc0e22fad89c80e08cc0e
parentc5e05e49b2bd0ca6aa94e0652885a091bfc6bef0
Get kill_remote() to work in shared Microsoft Windows build

The problem is that in a shared build there's a wrapper executable
generated by libtool (like the wrapper script on Unix-like platforms)
and we were using TerminateProcess() which only kills the single
requested process.

The solution is to create a new process group for each server and
then kill all processes in that process group by sending them
CTRL_BREAK_EVENT using GenerateConsoleCtrlEvent().

The only wrinkle is that this fails under Wine (at least when using
msvcrt - not tested with ucrt), but I've failed to come up with a
reduced testcase so far.  For now we skip the test in this situation
in CI.
xapian-core/configure.ac
xapian-core/tests/api_closedb.cc
xapian-core/tests/harness/backendmanager_remotetcp.cc