Added _is_single_user_process_alive to allow subclasses to reimplement

this without reimplementing the whole poll method.
This commit is contained in:
Ovidiu Ciule
2020-01-09 16:39:44 +01:00
parent 6227f92b5f
commit 3582ecc9cc

View File

@@ -1468,15 +1468,22 @@ class LocalProcessSpawner(Spawner):
self.clear_state()
return 0
# send signal 0 to check if PID exists
# this doesn't work on Windows, but that's okay because we don't support Windows.
alive = await self._signal(0)
alive = await self._is_single_user_process_alive()
if not alive:
self.clear_state()
return 0
else:
return None
async def _is_single_user_process_alive(self):
"""Returns True if the process still exists, False otherwise.
Allows subclasses to implement this in a platform specific manner.
"""
# send signal 0 to check if PID exists
# this doesn't work on Windows, but that's okay because we don't support Windows.
return await self._signal(0)
async def _signal(self, sig):
"""Send given signal to a single-user server's process.