fix(install): avoid /dev/stdin file redirect in guided installer (#3514)

Probe /dev/stdin readability before selecting it, and add /proc/self/fd/0
as a fallback for constrained containers where /dev/stdin is inaccessible.

Closes #3482
This commit is contained in:
Argenis 2026-03-14 17:52:03 -04:00 committed by Roman Tataurov
parent 9a634e64eb
commit 7eb86be726
No known key found for this signature in database
GPG Key ID: 70A51EF3185C334B

View File

@ -420,11 +420,18 @@ bool_to_word() {
}
guided_input_stream() {
if [[ -t 0 ]]; then
# Some constrained containers report interactive stdin (-t 0) but deny
# opening /dev/stdin directly. Probe readability before selecting it.
if [[ -t 0 ]] && (: </dev/stdin) 2>/dev/null; then
echo "/dev/stdin"
return 0
fi
if [[ -t 0 ]] && (: </proc/self/fd/0) 2>/dev/null; then
echo "/proc/self/fd/0"
return 0
fi
if (: </dev/tty) 2>/dev/null; then
echo "/dev/tty"
return 0