一个技巧:调用
os._exit以退出父进程,这样守护进程就不会被杀死。
但是还有其他一些副作用,如doc中所述:
Exit the process with status n, without calling cleanup handlers, flushing stdio buffers, etc.
如果您对此不关心,则可以使用它。

一个技巧:调用
os._exit以退出父进程,这样守护进程就不会被杀死。
但是还有其他一些副作用,如doc中所述:
Exit the process with status n, without calling cleanup handlers, flushing stdio buffers, etc.
如果您对此不关心,则可以使用它。