Fix atexit not working on SIGTERM (#1882)

This commit is contained in:
blurHY 2019-01-30 21:47:16 +08:00 committed by ZeroNet
parent 31a7effa5f
commit dd46a64e79
1 changed files with 4 additions and 0 deletions

View File

@ -11,6 +11,10 @@ def main():
main = None
try:
import signal
signal.signal(signal.SIGTERM, lambda signum, stack_frame: sys.exit(0))
app_dir = os.path.dirname(os.path.abspath(__file__))
os.chdir(app_dir) # Change working dir to zeronet.py dir
sys.path.insert(0, os.path.join(app_dir, "src/lib")) # External liblary directory