





















@@ -90,6 +90,16 @@ is_non_interactive_shell() {
9090return 1
9191}
929293+has_controlling_tty() {
94+if [[ ! -r /dev/tty || ! -w /dev/tty ]]; then
95+return 1
96+fi
97+if ! { : </dev/tty; } 2>/dev/null; then
98+return 1
99+fi
100+return 0
101+}
102+93103gum_is_tty() {
94104if [[ -n "${NO_COLOR:-}" ]]; then
95105return 1
@@ -100,7 +110,7 @@ gum_is_tty() {
100110if [[ -t 2 || -t 1 ]]; then
101111return 0
102112fi
103-if [[ -r /dev/tty && -w /dev/tty ]]; then
113+if has_controlling_tty; then
104114return 0
105115fi
106116return 1
@@ -1152,7 +1162,7 @@ is_promptable() {
11521162if [[ "$NO_PROMPT" == "1" ]]; then
11531163return 1
11541164fi
1155-if [[ -r /dev/tty && -w /dev/tty ]]; then
1165+if has_controlling_tty; then
11561166return 0
11571167fi
11581168return 1
@@ -2577,7 +2587,7 @@ run_bootstrap_onboarding_if_needed() {
25772587return
25782588fi
257925892580-if [[ ! -r /dev/tty || ! -w /dev/tty ]]; then
2590+if ! is_promptable; then
25812591local user_claw
25822592 user_claw="$(openclaw_command_for_user "${OPENCLAW_BIN:-}")"
25832593 ui_info "BOOTSTRAP.md found but no TTY; run ${user_claw} onboard to finish setup"
@@ -2962,7 +2972,7 @@ main() {
29622972 ui_kv "Switch to npm" "curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash -s -- --install-method npm"
29632973elif [[ "$is_upgrade" == "true" ]]; then
29642974 ui_info "Upgrade complete"
2965-if [[ -r /dev/tty && -w /dev/tty ]]; then
2975+if has_controlling_tty || [[ "$NO_ONBOARD" == "1" || "$NO_PROMPT" == "1" ]]; then
29662976local claw="${OPENCLAW_BIN:-}"
29672977if [[ -z "$claw" ]]; then
29682978 claw="$(resolve_openclaw_bin || true)"
@@ -3010,7 +3020,7 @@ main() {
30103020fi
30113021 ui_info "Starting setup"
30123022echo ""
3013-if [[ -r /dev/tty && -w /dev/tty ]]; then
3023+if is_promptable; then
30143024local claw="${OPENCLAW_BIN:-}"
30153025if [[ -z "$claw" ]]; then
30163026 claw="$(resolve_openclaw_bin || true)"
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。