mirror of
https://github.com/Cp0204/quark-auto-save.git
synced 2026-01-14 16:30:43 +08:00
🩹 添加运行脚本环境变量设置
- 确保输出编码为utf-8,避免编码问题
This commit is contained in:
parent
becaef7f19
commit
abc5ef4e40
@ -179,12 +179,18 @@ def run_script_now():
|
|||||||
)
|
)
|
||||||
|
|
||||||
def generate_output():
|
def generate_output():
|
||||||
|
# 设置环境变量
|
||||||
|
process_env = os.environ.copy()
|
||||||
|
process_env["PYTHONIOENCODING"] = "utf-8"
|
||||||
process = subprocess.Popen(
|
process = subprocess.Popen(
|
||||||
command,
|
command,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
universal_newlines=True,
|
universal_newlines=True,
|
||||||
|
encoding="utf-8",
|
||||||
|
errors="replace",
|
||||||
bufsize=1,
|
bufsize=1,
|
||||||
|
env=process_env,
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
for line in iter(process.stdout.readline, ""):
|
for line in iter(process.stdout.readline, ""):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user