mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-17 15:03:02 +00:00
Added _is_single_user_process_alive to allow subclasses to reimplement
this without reimplementing the whole poll method.
This commit is contained in:
@@ -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.
|
||||
|
||||
|
Reference in New Issue
Block a user