Wait for callback end if it could not be killed (#985)

that could happen if the script is running under a sudo
This commit is contained in:
Julien Tachoires
2019-03-11 10:35:36 +01:00
committed by Alexander Kukushkin
parent 8a7ba57457
commit 13f7aede61
+7 -2
View File
@@ -19,8 +19,13 @@ class CallbackExecutor(Thread):
def call(self, cmd):
with self._lock:
if self._process and self._process.poll() is None:
self._process.kill()
logger.warning('Killed the old callback process because it was still running: %s', self._cmd)
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()