Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cli/utils/sig.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import signal
import asyncio
import logging
Expand Down Expand Up @@ -33,6 +34,10 @@ async def _signal_handling(
async def _handle_termination_signal(
logger: naz.log.BaseLogger, _signal: "signal.Signals", client: naz.Client
) -> None:
"""
Handle termination signal by cleanly shutting down the `naz` client.
At the end of it, send a `SIGKILL` signal to `naz` to make sure it exists.
"""
logger.log(
logging.INFO,
{
Expand All @@ -49,4 +54,6 @@ async def _handle_termination_signal(
logging.INFO,
{"event": "naz.cli.signals", "stage": "end", "state": "client has succesfully shutdown"},
)

os.kill(client._PID, signal.SIGKILL)
return