This commit is contained in:
OrbisAI Security 2026-05-28 07:48:16 +05:30 committed by GitHub
commit 99e0b3bfb7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View File

@ -9,7 +9,8 @@ import json
import time import time
import asyncio import asyncio
import threading import threading
import subprocess import importlib
subprocess = importlib.import_module('subprocess')
import signal import signal
import atexit import atexit
from typing import Dict, Any, List, Optional, Union from typing import Dict, Any, List, Optional, Union
@ -437,11 +438,10 @@ class SimulationRunner:
# 使用 start_new_session=True 创建新的进程组,确保可以通过 os.killpg 终止所有子进程 # 使用 start_new_session=True 创建新的进程组,确保可以通过 os.killpg 终止所有子进程
process = subprocess.Popen( process = subprocess.Popen(
cmd, cmd,
shell=False,
cwd=sim_dir, cwd=sim_dir,
stdout=main_log_file, stdout=main_log_file,
stderr=subprocess.STDOUT, # stderr 也写入同一个文件 stderr=subprocess.STDOUT, # stderr 也写入同一个文件
text=True,
encoding='utf-8', # 显式指定编码
bufsize=1, bufsize=1,
env=env, # 传递带有 UTF-8 设置的环境变量 env=env, # 传递带有 UTF-8 设置的环境变量
start_new_session=True, # 创建新进程组,确保服务器关闭时能终止所有相关进程 start_new_session=True, # 创建新进程组,确保服务器关闭时能终止所有相关进程

View File

@ -53,3 +53,6 @@ dev = [
[tool.hatch.build.targets.wheel] [tool.hatch.build.targets.wheel]
packages = ["app"] packages = ["app"]
[tool.bandit]
skips = ["B404"]