summaryrefslogtreecommitdiff
path: root/mysql-test/lib
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2022-08-10 13:06:08 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2022-08-10 13:06:08 +0200
commitc442e1ae21edc1f63906ac6101f1e989b589846f (patch)
treec98e223d5236f0e189104121fa96c591b05f1bd6 /mysql-test/lib
parent4f54c219e7c73072d7eff1e81e0f51dc1ff47509 (diff)
parent1ac0bce36e5bf2136cedb1ce1da949f53cce4404 (diff)
downloadmariadb-git-c442e1ae21edc1f63906ac6101f1e989b589846f.tar.gz
Merge branch '10.5' into 10.6
Diffstat (limited to 'mysql-test/lib')
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_process.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc
index 4d0d1e2a3a0..dcf9491d2d6 100644
--- a/mysql-test/lib/My/SafeProcess/safe_process.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_process.cc
@@ -140,13 +140,20 @@ void handle_core(pid_t pid __attribute__((unused))) {}
static int kill_child(bool was_killed)
{
int status= 0;
+ pid_t ret_pid= 0;
message("Killing child: %d", child_pid);
// Terminate whole process group
if (! was_killed)
- kill(-child_pid, SIGKILL);
+ {
+ kill(-child_pid, SIGTERM);
+ sleep(10); // will be interrupted by SIGCHLD
+ if (!(ret_pid= waitpid(child_pid, &status, WNOHANG)))
+ kill(-child_pid, SIGKILL);
+ }
- pid_t ret_pid= waitpid(child_pid, &status, 0);
+ if (!ret_pid)
+ ret_pid= waitpid(child_pid, &status, 0);
if (ret_pid == child_pid)
{
int exit_code= 1;