Skip to content

Instantly share code, notes, and snippets.

# 检测 python 脚本是否运行,一旦检测到程序停止就启动脚本并且将输出显示到当前屏幕上
# 按下 ctrl + c 后(按一次就行)会依次对接管的脚本发送 ctrl + c,使程序能捕获 KeyboardInterrupt 异常并退出
import psutil
import os
import sys
import pexpect
from loguru import logger
from time import sleep
from concurrent.futures import ThreadPoolExecutor