fix: use user dir on Windows, detect pipe execution for one-click install

- Windows default: $env:USERPROFILE\hapi instead of C:\hapi
- PowerShell: detect iex/pipe execution ($PSCommandPath empty) to skip
  Read-Host prompt and enter quick install mode
- Bash: detect curl|bash pipe (! -t 0) to enter quick install mode
- This fixes scripts hanging on menu prompts when run via irm|iex
  or curl|bash

via [HAPI](https://hapi.run)

Co-Authored-By: HAPI <[email protected]>
This commit is contained in:
i
2026-06-02 00:09:31 +08:00
co-authored by HAPI
parent 14791602d6
commit 305d07e14b
2 changed files with 13 additions and 5 deletions
+2 -2
View File
@@ -1503,8 +1503,8 @@ main() {
: > "$LOG_FILE"
# 如果带有旧版参数,进入快速模式
if [[ "$UPGRADE_ONLY" == true || "$FORCE" == true || -n "$SOURCE" || "$SKIP_HUB" == true || -n "$INSTALL_DIR_ARG" ]]; then
# 如果带有旧版参数,或是管道执行(curl | bash),进入快速模式
if [[ "$UPGRADE_ONLY" == true || "$FORCE" == true || -n "$SOURCE" || "$SKIP_HUB" == true || -n "$INSTALL_DIR_ARG" || ! -t 0 ]]; then
echo ""
echo -e "${BOLD}╔══════════════════════════════════════════════════════════════════╗${NC}"
echo -e "${BOLD}║${NC} HAPI 快速模式 ${BOLD}║${NC}"