mirror of
https://github.com/RockChinQ/QChatGPT.git
synced 2024-11-16 11:42:44 +08:00
feat: 删除父进程判断 (#750)
This commit is contained in:
parent
a6b875a242
commit
e2becf7777
16
main.py
16
main.py
|
@ -32,20 +32,6 @@ async def main_entry():
|
||||||
print("已自动安装缺失的依赖包,请重启程序。")
|
print("已自动安装缺失的依赖包,请重启程序。")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
# 检查命令行
|
|
||||||
import os
|
|
||||||
|
|
||||||
if os.name == 'nt':
|
|
||||||
import psutil
|
|
||||||
allowed_parent_process = ['cmd.exe', 'powershell.exe', 'wsl.exe']
|
|
||||||
|
|
||||||
parent_process = psutil.Process(os.getppid()).name()
|
|
||||||
|
|
||||||
if parent_process not in allowed_parent_process:
|
|
||||||
print("请在命令行中运行此程序。")
|
|
||||||
input("按任意键退出...")
|
|
||||||
exit(0)
|
|
||||||
|
|
||||||
# 检查配置文件
|
# 检查配置文件
|
||||||
|
|
||||||
from pkg.core.bootutils import files
|
from pkg.core.bootutils import files
|
||||||
|
@ -77,7 +63,7 @@ if __name__ == '__main__':
|
||||||
if "QChatGPT/main.py" not in content:
|
if "QChatGPT/main.py" not in content:
|
||||||
invalid_pwd = True
|
invalid_pwd = True
|
||||||
if invalid_pwd:
|
if invalid_pwd:
|
||||||
print("请在QChatGPT项目根目录下运行此程序。")
|
print("请在QChatGPT项目根目录下以命令形式运行此程序。")
|
||||||
input("按任意键退出...")
|
input("按任意键退出...")
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user