import signal
import sys
import time


def run(func):
    # SIGINT 终止进程 中断进程
    def quit(signum, frame):
        if func is not None:
            func()
        print("Shutdown...")
        sys.exit(0)

    signal.signal(signal.SIGINT, quit)
    while True:
        time.sleep(1)
