fix(common.sh): use tty open test instead of -r for no-TTY detection
macOS /dev/tty passes -r check even when unusable in non-TTY sessions; replace with `true < /dev/tty` probe so confirm_destructive and confirm_exact_match correctly detect missing TTY and emit the expected error message instead of crashing with "Device not configured".
This commit is contained in:
@@ -158,7 +158,7 @@ confirm_destructive() {
|
|||||||
if [[ "${GITEA_YES:-0}" == "1" ]]; then
|
if [[ "${GITEA_YES:-0}" == "1" ]]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if [[ ! -r /dev/tty ]]; then
|
if ! { true < /dev/tty; } 2>/dev/null; then
|
||||||
log_err "需要確認但無 TTY;請加 -y / --yes 或設定 GITEA_YES=1"
|
log_err "需要確認但無 TTY;請加 -y / --yes 或設定 GITEA_YES=1"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -178,7 +178,7 @@ confirm_exact_match() {
|
|||||||
if [[ "${GITEA_YES:-0}" == "1" ]]; then
|
if [[ "${GITEA_YES:-0}" == "1" ]]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if [[ ! -r /dev/tty ]]; then
|
if ! { true < /dev/tty; } 2>/dev/null; then
|
||||||
log_err "需要確認但無 TTY;請加 -y / --yes 或設定 GITEA_YES=1"
|
log_err "需要確認但無 TTY;請加 -y / --yes 或設定 GITEA_YES=1"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user