Wait for callback end if it could not be killed
that could happen if the script is running under a sudo
@@ -19,8 +19,13 @@ class CallbackExecutor(Thread):
def call(self, cmd):
with self._lock:
if self._process and self._process.poll() is None:
+ try:
self._process.kill()
logger.warning('Killed the old callback process because it was still running: %s', self._cmd)
+ except OSError:
+ logger.exception('Failed to kill the old callback')
+ logger.warning('Wait until callback end')
+ self._process.wait()
self._cmd = cmd
self._callback_event.set()
