Fixing nohup issue
This commit is contained in:
parent
a22fe1b9e7
commit
432a8b2059
@ -465,11 +465,15 @@ class XMPPClient(ClientXMPP):
|
||||
async def _run(self):
|
||||
self._stopped = asyncio.Event()
|
||||
self._loop = asyncio.get_running_loop()
|
||||
for sig in (signal.SIGTERM, signal.SIGHUP):
|
||||
try:
|
||||
self._loop.add_signal_handler(sig, self._stopped.set)
|
||||
except NotImplementedError:
|
||||
pass
|
||||
|
||||
# Hanya tangani SIGTERM untuk shutdown.
|
||||
# SENGATKAN SIGHUP: nohup kirim SIGHUP saat terminal close,
|
||||
# dan kita tidak mau proses mati karena itu.
|
||||
try:
|
||||
self._loop.add_signal_handler(signal.SIGTERM, self._stopped.set)
|
||||
except NotImplementedError:
|
||||
pass
|
||||
|
||||
await self.connect()
|
||||
try:
|
||||
await self._stopped.wait()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user