mirror of
https://github.com/whyour/qinglong.git
synced 2026-03-13 15:05:10 +08:00
Fix Python relative path issue: correct CWD for subdirectory scripts
Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
parent
bf7350f10b
commit
e8abaeb83c
|
|
@ -92,7 +92,7 @@ run_normal() {
|
||||||
|
|
||||||
cd $dir_scripts
|
cd $dir_scripts
|
||||||
local relative_path="${file_param%/*}"
|
local relative_path="${file_param%/*}"
|
||||||
if [[ ${file_param} != /* ]] && [[ ! -z ${relative_path} ]] && [[ ${file_param} =~ "/" ]]; then
|
if [[ ! -z ${relative_path} ]] && [[ ${file_param} =~ "/" ]]; then
|
||||||
cd ${relative_path}
|
cd ${relative_path}
|
||||||
file_param=${file_param/$relative_path\//}
|
file_param=${file_param/$relative_path\//}
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ def run():
|
||||||
os.environ["PYTHONPATH"] = prev_pythonpath
|
os.environ["PYTHONPATH"] = prev_pythonpath
|
||||||
|
|
||||||
split_str = "__sitecustomize__"
|
split_str = "__sitecustomize__"
|
||||||
file_name = sys.argv[0].replace(f"{os.getenv('dir_scripts')}/", "")
|
file_name = os.path.abspath(sys.argv[0]).replace(f"{os.getenv('dir_scripts')}/", "")
|
||||||
|
|
||||||
# 创建临时文件路径
|
# 创建临时文件路径
|
||||||
temp_file = f"/tmp/env_{os.getpid()}.json"
|
temp_file = f"/tmp/env_{os.getpid()}.json"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user