@hunyed15/codecgc 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
|
+
import os
|
|
2
3
|
import subprocess
|
|
3
4
|
import sys
|
|
4
5
|
from pathlib import Path
|
|
@@ -25,6 +26,11 @@ def parse_json_text(text: str) -> dict[str, Any]:
|
|
|
25
26
|
|
|
26
27
|
def run_json_script(script_name: str, *args: str) -> dict[str, Any]:
|
|
27
28
|
command = build_script_command(script_name, *args)
|
|
29
|
+
|
|
30
|
+
# 设置环境变量,确保子进程使用正确的工作目录
|
|
31
|
+
env = os.environ.copy()
|
|
32
|
+
env["CODECGC_WORKSPACE_ROOT"] = str(PROJECT_WORKSPACE)
|
|
33
|
+
|
|
28
34
|
completed = subprocess.run(
|
|
29
35
|
command,
|
|
30
36
|
cwd=PROJECT_WORKSPACE,
|
|
@@ -33,6 +39,7 @@ def run_json_script(script_name: str, *args: str) -> dict[str, Any]:
|
|
|
33
39
|
text=True,
|
|
34
40
|
encoding="utf-8",
|
|
35
41
|
errors="replace",
|
|
42
|
+
env=env, # 传递环境变量
|
|
36
43
|
)
|
|
37
44
|
|
|
38
45
|
stdout = completed.stdout.strip()
|