mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-01 04:40:38 +08:00
修复任务执行初始化环境变量 PYTHONPATH 和 NODE_OPTIONS 被清空
This commit is contained in:
@@ -36,6 +36,9 @@ def expand_range(range_str, max_value):
|
||||
|
||||
def run():
|
||||
try:
|
||||
prev_pythonpath = os.getenv("PREV_PYTHONPATH", "")
|
||||
os.environ["PYTHONPATH"] = prev_pythonpath
|
||||
|
||||
split_str = "__sitecustomize__"
|
||||
file_name = sys.argv[0].replace(f"{os.getenv('dir_scripts')}/", "")
|
||||
command = f'bash -c "source {os.getenv("file_task_before")} {file_name}'
|
||||
@@ -46,7 +49,10 @@ def run():
|
||||
command += f" && eval '{escape_task_before}'"
|
||||
print("执行前置命令\n")
|
||||
|
||||
python_command = "PYTHONPATH= python3 -c 'import os, json; print(json.dumps(dict(os.environ)))'"
|
||||
prev_pythonpath = os.getenv("PREV_PYTHONPATH", "")
|
||||
python_command = (
|
||||
"python3 -c 'import os, json; print(json.dumps(dict(os.environ)))'"
|
||||
)
|
||||
command += f" && echo -e '{split_str}' && {python_command}\""
|
||||
|
||||
res = subprocess.check_output(command, shell=True, encoding="utf-8")
|
||||
|
||||
Reference in New Issue
Block a user