Python Process won't call atexit

后端 未结 1 1492
遥遥无期
遥遥无期 2020-12-20 12:25

I\'m trying to use atexit in a Process, but unfortunately it doesn\'t seem to work. Here\'s some example code:

import time
import a         


        
相关标签:
1条回答
  • 2020-12-20 12:44

    As the docs say,

    On Unix this is done using the SIGTERM signal; on Windows TerminateProcess() is used. Note that exit handlers and finally clauses, etc., will not be executed.

    If you're on Unix, you should be able intercept SIGTERM with signal, and perform whatever "termination activities" you need; however, I don't know of a cross-platform solution.

    0 讨论(0)
提交回复
热议问题