mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
修复 node 前置逻辑
This commit is contained in:
parent
2ad6437672
commit
eddd258614
|
@ -216,8 +216,13 @@ check_file() {
|
|||
if [[ -f $file_env ]]; then
|
||||
get_env_array
|
||||
if [[ $isJsOrPythonFile == 'true' ]]; then
|
||||
export NODE_OPTIONS="${NODE_OPTIONS} -r ${file_preload_js}"
|
||||
export PYTHONPATH="${PYTHONPATH}:${dir_preload}:${dir_config}"
|
||||
PREV_NODE_OPTIONS="${NODE_OPTIONS}"
|
||||
PREV_PYTHONPATH="${PYTHONPATH}"
|
||||
if [[ $1 == *.js ]] || [[ $1 == *.ts ]]; then
|
||||
export NODE_OPTIONS="${NODE_OPTIONS} -r ${file_preload_js}"
|
||||
else
|
||||
export PYTHONPATH="${PYTHONPATH}:${dir_preload}:${dir_config}"
|
||||
fi
|
||||
else
|
||||
. $file_env
|
||||
fi
|
||||
|
@ -265,6 +270,10 @@ if [[ $isJsOrPythonFile == 'false' ]]; then
|
|||
run_task_before "${task_shell_params[@]}"
|
||||
fi
|
||||
main "${task_shell_params[@]}"
|
||||
if [[ $isJsOrPythonFile == 'true' ]]; then
|
||||
export NODE_OPTIONS="${PREV_NODE_OPTIONS}"
|
||||
export PYTHONPATH="${PREV_PYTHONPATH}"
|
||||
fi
|
||||
run_task_after "${task_shell_params[@]}"
|
||||
clear_env
|
||||
handle_task_end "${task_shell_params[@]}"
|
||||
|
|
|
@ -41,10 +41,10 @@ function run() {
|
|||
const fileName = process.argv[1].replace(`${dir_scripts}/`, '');
|
||||
let command = `bash -c "source ${file_task_before} ${fileName}`;
|
||||
if (task_before) {
|
||||
command = `${command} && echo -e '执行前置命令\n' && eval "${task_before}" && echo -e '\n执行前置命令结束\n'`;
|
||||
command = `${command} && echo -e '执行前置命令\n' && eval '${task_before}' && echo -e '\n执行前置命令结束\n'`;
|
||||
}
|
||||
const res = execSync(
|
||||
`${command} && echo "${splitStr}" && NODE_OPTIONS= node -p 'JSON.stringify(process.env)'"`,
|
||||
`${command} && echo -e '${splitStr}' && NODE_OPTIONS= node -p 'JSON.stringify(process.env)'"`,
|
||||
{
|
||||
encoding: 'utf-8',
|
||||
},
|
||||
|
|
|
@ -54,10 +54,10 @@ def run():
|
|||
task_before = os.getenv("task_before")
|
||||
|
||||
if task_before:
|
||||
command += f" && echo -e '执行前置命令\n' && eval \"{task_before}\" && echo -e '\n执行前置命令结束\n'"
|
||||
command += f" && echo -e '执行前置命令\n' && eval '{task_before}' && echo -e '\n执行前置命令结束\n'"
|
||||
|
||||
python_command = "PYTHONPATH= python3 -c 'import os, json; print(json.dumps(dict(os.environ)))'"
|
||||
command += f' && echo "{split_str}" && {python_command}"'
|
||||
command += f" && echo -e '{split_str}' && {python_command}\""
|
||||
|
||||
res = subprocess.check_output(command, shell=True, encoding="utf-8")
|
||||
output, env_str = res.split(split_str)
|
||||
|
|
Loading…
Reference in New Issue
Block a user