From 18474d89f8d98d21f45617c876bd8a8e64daeb8e Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 12 Sep 2022 16:17:55 +0200 Subject: [PATCH] SystemExec try SIGINT before SIGKILL Even though SIGINT is intended to be sent from terminals only, it is more successful at terminating various child processes than closing stdin and sending SIGTERM. --- libs/pbd/system_exec.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libs/pbd/system_exec.cc b/libs/pbd/system_exec.cc index 574a1aa5b7..dfafa1a3ac 100644 --- a/libs/pbd/system_exec.cc +++ b/libs/pbd/system_exec.cc @@ -682,6 +682,13 @@ SystemExec::terminate () wait(WNOHANG); } + if (pid) { + ::kill(pid, SIGINT); + ::usleep(250000); + sched_yield(); + wait(WNOHANG); + } + /* if pid is non-zero, the child task is STILL executing after being * sent SIGTERM. Act tough ... send SIGKILL */