Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix: add SIGTERM, SIGHUP handling and ignore SIGPIPE
chengyongruaed1ef552984
diff --git a/nanobot/cli/commands.py b/nanobot/cli/commands.pyindex 2662e9fe7..8c53992b6 100644--- a/nanobot/cli/commands.py+++ b/nanobot/cli/commands.py@@ -501,12 +501,17 @@ def agent(else:cli_channel, cli_chat_id = "cli", session_id- def _exit_on_sigint(signum, frame):+ def _handle_signal(signum, frame):+ sig_name = signal.Signals(signum).name_restore_terminal()- console.print("\nGoodbye!")- os._exit(0)-- signal.signal(signal.SIGINT, _exit_on_sigint)+ console.print(f"\nReceived {sig_name}, goodbye!")+ sys.exit(0)++ signal.signal(signal.SIGINT, _handle_signal)+ signal.signal(signal.SIGTERM, _handle_signal)+ signal.signal(signal.SIGHUP, _handle_signal)+ # Ignore SIGPIPE to prevent silent process termination when writing to closed pipes+ signal.signal(signal.SIGPIPE, signal.SIG_IGN)async def run_interactive():bus_task = asyncio.create_task(agent_loop.run())