Update SW_run.py
Browse files
SW_run.py
CHANGED
@@ -17,13 +17,16 @@ cleaned_code = '\n'.join(line.strip() for line in code.splitlines() if line.stri
|
|
17 |
# 执行干净的代码
|
18 |
exec(cleaned_code)
|
19 |
|
|
|
|
|
|
|
20 |
# 检查是否存在 logs_run.txt 文件,如果存在则删除它
|
21 |
-
log_file = '/etc/logs_run.txt'
|
22 |
if os.path.exists(log_file):
|
23 |
os.remove(log_file)
|
24 |
|
25 |
# 检查是否存在 url.txt 文件,如果存在则删除它
|
26 |
-
url_file = '/etc/url.txt'
|
27 |
if os.path.exists(url_file):
|
28 |
os.remove(url_file)
|
29 |
|
@@ -47,7 +50,7 @@ os.chdir('/etc/main/')
|
|
47 |
try:
|
48 |
# 在 try 块中运行 /etc/main/webui.py,并将输出重定向到日志文件
|
49 |
with open(log_file, 'a') as log_file_handle, open(url_file, 'a') as url_file_handle:
|
50 |
-
process = subprocess.Popen(['python',
|
51 |
|
52 |
url_pattern = re.compile(r'https?://\S+')
|
53 |
|
|
|
17 |
# 执行干净的代码
|
18 |
exec(cleaned_code)
|
19 |
|
20 |
+
# 获取元组中的字符串并去除括号
|
21 |
+
StartBL = StartBL[0].strip('()')
|
22 |
+
|
23 |
# 检查是否存在 logs_run.txt 文件,如果存在则删除它
|
24 |
+
log_file = '/etc/main/logs_run.txt'
|
25 |
if os.path.exists(log_file):
|
26 |
os.remove(log_file)
|
27 |
|
28 |
# 检查是否存在 url.txt 文件,如果存在则删除它
|
29 |
+
url_file = '/etc/main/url.txt'
|
30 |
if os.path.exists(url_file):
|
31 |
os.remove(url_file)
|
32 |
|
|
|
50 |
try:
|
51 |
# 在 try 块中运行 /etc/main/webui.py,并将输出重定向到日志文件
|
52 |
with open(log_file, 'a') as log_file_handle, open(url_file, 'a') as url_file_handle:
|
53 |
+
process = subprocess.Popen(['python', StartBL ], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
|
54 |
|
55 |
url_pattern = re.compile(r'https?://\S+')
|
56 |
|