Skip to content

fix(installer): stop CLI input loops on EOF - #2547

Merged
Seiger merged 1 commit into
evolution-cms:3.6.xfrom
MiddleSokilAI:sokil/cli-installer-eof
Nov 2, 2026
Merged

Seiger merged 1 commit into
evolution-cms:3.6.xfrom
MiddleSokilAI:sokil/cli-installer-eof

Conversation

@MiddleSokilAI

Copy link
Copy Markdown
Collaborator

Problem

When readline() returns false at EOF, choice() retries indefinitely and ask() converts it into an empty answer. Required-field loops can then consume a CPU core. This also happens when every CLI flag is supplied but an existing table prefix triggers another prompt.

Branch and changes

Targets 3.6.x, where the reported installer runs. Both prompt methods now throw a contextual RuntimeException on EOF; the existing CLI entrypoint reports it and exits with status 1. Defaults still require an actual empty input line, and piped answers remain supported without a TTY. Prefix collision recovery remains interactive when input is available.

Landing surfaces: install/cli-install.php, a child-process input fixture, and a standalone regression test discovered by the existing test harness. The installer header documents the EOF contract.

Verification

  • Reproduced the original EOF loops on upstream 9e52db5b: missing mode, missing database, and SQLite prefix collision with all CLI flags supplied. Bounded baseline probes hit their deadlines.
  • Regression script passes on PHP 8.4.20 (WSL) and PHP 8.5.10 (Docker).
  • cd core && php vendor/bin/pest tests/Unit/Install: 90 passed, 558 assertions.
  • cd core && php vendor/bin/pest tests/Unit/StandaloneScriptsTest.php --filter=CliInstallInputTest: passed through the existing Pest harness (3 assertions; 17 bounded child-process cases).
  • composer analyze: no errors. PHP syntax checks and git diff --check: passed.
  • Real closed stdin pipe and /dev/null: exit 1 for missing selections/values and for an existing SQLite prefix, with the unanswered question in the error.
  • Empty-line defaults, trimmed text, invalid selection followed by valid input, invalid selection followed by EOF, and interactive prefix recovery.
  • Prefix collision leaves existing SQLite data and install/ intact and does not write database configuration, even with --removeInstall=y.

Scope and remaining items

No changes to database migrations, Composer restoration, or installer cleanup. This fixes the demonstrated EOF loops; it does not establish the cause of a reported process that continued after its script had been deleted. No live site was modified.

@MiddleSokilAI
MiddleSokilAI requested a review from Seiger November 2, 2026 19:19
@Seiger
Seiger merged commit b1b16dc into evolution-cms:3.6.x Nov 2, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants