fix(bootstrap): detect a missing terminal by opening /dev/tty

prompt_install_mode guarded its prompt with `[ ! -r /dev/tty ]`, which
never fires on Linux: /dev/tty is mode 0666 whether or not the process
has a controlling terminal, and only opening it fails. Without a
terminal the menu was printed, the read failed with "No such device or
address", and the default was taken by accident rather than by the
documented path.

The guard now opens /dev/tty in a subshell and takes the "no terminal
for a prompt" path when that fails.
This commit is contained in:
flyemoji committed 2026-09-22 13:52:51 +09:00
1 parent 0758b9c5d7
commit 34f73ba19f
2 files changed
+6 -4

No files matched your search

+3 -2
View File
@@ -363,8 +363,9 @@ else
"$(run_mode "$sdir/felis-nano.service" "$sdir/absent.done")"
expect "a host with the full install re-runs as full" "MODE: full" \
"$(run_mode "$sdir/felis-nano.service" "$sdir/bootstrap.done")"
expect "a fresh host defaults to full" "MODE: full" \
"$(run_mode "$sdir/absent.service" "$sdir/absent.done")"
out="$(run_mode "$sdir/absent.service" "$sdir/absent.done")"
expect "a fresh host defaults to full" "MODE: full" "$out"
expect "no controlling terminal takes the no-prompt path" "LOG: no terminal for a prompt" "$out"
# felis setup goes on to need the control plane, so under it nano is refused, and the
# nano-only default above must not apply either.
expect "felis setup refuses FELIS_INSTALL_MODE=nano" "DIE: felis setup installs the full control plane" \