diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2022-08-10 12:21:08 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2022-08-10 12:21:08 +0200 |
commit | 65e8506ca9d03967191b6ed207cf107d311f7f99 (patch) | |
tree | 3076ff798884b52655a5961be21e799708a4b628 /mysql-test/lib/My/SafeProcess | |
parent | 6adfce9c8d2a63a259dd0504600271498dcda228 (diff) | |
parent | faddcf3c395da640b760c3f701f5bc1f3baae6c4 (diff) | |
download | mariadb-git-65e8506ca9d03967191b6ed207cf107d311f7f99.tar.gz |
Merge branch '10.3' into bb-10.4-releasemariadb-10.4.26
Diffstat (limited to 'mysql-test/lib/My/SafeProcess')
-rw-r--r-- | mysql-test/lib/My/SafeProcess/safe_process.cc | 11 |
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; |