我有以下代码:
try:
self._collect_persons_status()
except manager.AsteriskManagerError:
# If it is not possible to continue with the collection of initial
# person statuses via Asterisk Manager, end the program with an
# error code.
logger.debug('*** exit with 1!!')
sys.exit(1)
Run Code Online (Sandbox Code Playgroud)
该脚本通过 systemd 处理(作为带循环的守护进程运行)。
从日志中我可以看到*** exit with 1!!已打印,但脚本以代码 0 结束,而不是预期的 1:
我究竟做错了什么?