Skip to content

Commit ee8ff85

Browse files
committed
fix: 对未找到路径的情况进行处理
1 parent 6b94fd2 commit ee8ff85

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Diff for: src/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env python
2+
# -*- encoding: utf-8 -*-

Diff for: task_scheduler.py renamed to src/task_scheduler.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
import time
77
import psutil
88
import rcon
9-
import read_conf
9+
from src import read_conf
1010
import threading
11-
from utils.log_control import INFO
11+
from src.utils.log_control import INFO
1212
from rcon.source import Client
1313
from rcon.source.proto import Packet
1414

@@ -79,7 +79,13 @@ def start_program(self):
7979
program_args.extend(["-useperfthreads", "-NoAsyncLoadingThread", "-UseMultithreadForDS"])
8080
print("[ 启动任务 ] 启动参数:", self.conf['arguments'].split())
8181

82-
subprocess.Popen(program_args)
82+
try:
83+
subprocess.Popen(program_args)
84+
except FileNotFoundError as e:
85+
INFO.logger.error(f"[ 启动任务 ] 请检查config.ini配置路径,错误信息: {e}")
86+
print(f"\r[ 启动任务 ] 请检查config.ini配置路径,错误信息: {e}")
87+
time.sleep(3)
88+
exit(1)
8389

8490
# 尝试连接
8591
if self.conf['rcon_enabled']:

0 commit comments

Comments
 (0)