mirror of
https://github.com/OLmatter/glm-coding-helper.git
synced 2026-10-07 13:28:18 +08:00
fix(setup): invoke Linux setup_backend via explicit bash to avoid execute-bit / interpreter issues
Previously invoke_setup splatted the script path with its arguments directly
(""${args[@]}""), which relies on the script having a valid shebang and
the executable bit set when invoked from a different process state or via
some shell wrappers. The Windows Invoke-Bootstrap counterpart launches
its bootstrap via a stable interpreter entry (powershell -File), and the
Linux path should be at least as robust.
- Resolve the setup script to an absolute path under $SCRIPT_DIR and run
it explicitly with 'bash "$setup_script" "${setup_args[@]}"', so the
shebang/exec bit is not on the critical path.
- Rename the local array to setup_args / setup_script to make intent
clearer at the call sites.
This keeps the recreate-on-existing-python behaviour from the previous
fix and matches the Windows pipeline's "stable interpreter invocation"
convention.
This commit is contained in:
+5
-4
@@ -161,21 +161,22 @@ invoke_setup() {
|
||||
local setup_target="$1"
|
||||
local venv_py="$2"
|
||||
local force_recreate="${3:-0}"
|
||||
local args=("scripts/setup_backend_linux.sh" "--target" "$setup_target")
|
||||
local setup_script="$SCRIPT_DIR/scripts/setup_backend_linux.sh"
|
||||
local -a setup_args=("--target" "$setup_target")
|
||||
|
||||
# 与 Windows Invoke-Bootstrap 一致:外来/损坏 venv,或目标 python 已存在时先删再建。
|
||||
if [ "$force_recreate" -eq 1 ] || { [ -n "$venv_py" ] && [ -e "$venv_py" ]; }; then
|
||||
echo "Existing backend environment failed portability/import checks. Recreating it..."
|
||||
args+=("--recreate")
|
||||
setup_args+=("--recreate")
|
||||
fi
|
||||
|
||||
for arg in "${PIP_ARGS[@]}"; do
|
||||
args+=("--pip-arg" "$arg")
|
||||
setup_args+=("--pip-arg" "$arg")
|
||||
done
|
||||
|
||||
mkdir -p "$SCRIPT_DIR/logs"
|
||||
echo "详细安装日志: $SCRIPT_DIR/logs/backend-install.log"
|
||||
"${args[@]}" 2>&1 | tee "$SCRIPT_DIR/logs/backend-install.log"
|
||||
bash "$setup_script" "${setup_args[@]}" 2>&1 | tee "$SCRIPT_DIR/logs/backend-install.log"
|
||||
}
|
||||
|
||||
assert_required_files
|
||||
|
||||
Reference in New Issue
Block a user