Windows one-liner install, Linux install fixes, older-patch hint (1.9.1)#20
Merged
Conversation
- install.ps1 now downloads phpvm.ps1 from the repo when it is not sitting next to the script, so `irm .../windows/install.ps1 | iex` works with nothing on disk. This is what linux/install.sh already did; Windows was the outlier and the reason the README had to ask for a two-file manual download. Running from a clone still copies the local file. The download failure path throws instead of calling exit, which under `iex` would close the user's whole session. - phpvm composer: redirect the version probe's stderr. Composer prints its PHP banner and the "run diagnose" hint on stderr, which bypassed the formatting pipeline and leaked unindented into the output. linux/phpvm.sh:1049 already did this; Windows had drifted. devhardiyanto
…ser's shell
Both surfaced testing 1.9.0 on WSL2.
- phpvm.sh is sourced, so phpvm_install's `cd "$src_dir"` moved the *user's own*
shell into the build directory — which the cleanup step then deleted, leaving
them sitting in a dangling cwd. None of the failure paths cd'd back either.
The build now runs in a subshell, so the cd cannot escape at all rather than
being undone at four separate return points.
- The spinner's background job printed the interactive shell's job-control
notices ("[3] 2015", "[3] + done ...") around every build step. Turn the
monitor off while the job runs and restore it exactly as found. CI never saw
this: job control is off in non-interactive shells.
Windows is unaffected — Invoke-Install extracts a zip and never changes
directory.
devhardiyanto
An em-dash slipped into a comment, tripping PSScriptAnalyzer's PSUseBOMForUnicodeEncodedFile. The rest of the Windows scripts are ASCII. devhardiyanto
Linux got five bats tests for the patch-line selection; Windows had none, so the same off-by-one risks (lexical sort, 8.50.x matching the 8.5 line) were untested there. devhardiyanto
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Follow-up fixes after 1.9.0 hit real machines. Two of them are regressions from the 1.9.0 spinner; the rest are long-standing drift. Bumps 1.9.0 -> 1.9.1.
Why
cdleaked into the user's shell (Linux/macOS).phpvm.shis sourced, sophpvm_install'scd "$src_dir"moved the user's own shell into the build directory — which cleanup then deleted, stranding them in a dangling cwd:This is not distro- or environment-specific: it follows from the script being sourced, so it affects every shell that sources
phpvm.sh. None of the failure paths cd'd back either, so a failed build stranded the user just as a successful one did.Job-control noise (regression from 1.9.0). The new spinner's background job made the interactive shell announce it on every build step:
CI never caught this — job control is off in non-interactive shells.
One-liner install. Linux installs with a single
curl … | bash; Windows made users download two files by hand.install.ps1readphpvm.ps1from$PSScriptRoot, which is empty when piped intoiex, so the one-liner could never have worked.linux/install.shalready fetches from the repo — Windows was the outlier.Composer stderr banner. After
phpvm composer, two unindented lines broke the output. Composer writes its PHP banner and the "run diagnose" hint to stderr, bypassing the formatting pipeline. Not an error, just noise.linux/phpvm.shalready redirected it; Windows had drifted. Same class as thephpvm usebanner fixed in 1.9.0.Older-patch hint.
phpvm install 8resolves to the newest patch and installs it alongside any older patch of the same line, quietly leaving both. It now says so. It does not remove the old one: another project may pin that exact patch in.phpvmrc, and silently deleting a PHP someone still uses is not a tradeoff worth making.How
linux/phpvm.sh— the build runs in a subshell, so thecdcannot escape at all, rather than being undone at four separate return points. Whatever directory you runphpvm installfrom, you are still in it afterwards — including when the build fails._phpvm_run_loggedturns the shell's monitor mode off while its job runs and restores it exactly as found.windows/install.ps1— use the localphpvm.ps1when running from a clone, otherwise fetch fromraw.githubusercontent.com. The failure paththrows rather thanexits: underirm … | iex,exitcloses the user's whole session instead of aborting the install.windows/phpvm.ps1—2>$nullon the composer version probe; newGet-OlderPatch/Show-OlderPatchHint, mirrored by_phpvm_older_patches/_phpvm_older_patch_hinton Linux.README.md— lead with the one-liner; keep the manual flow for anyone who would rather read the script first.Changes
linux/phpvm.sh— subshell'd build, monitor-mode handling, older-patch hintwindows/install.ps1— remote fetch fallback,throwinstead ofexitwindows/phpvm.ps1— composer stderr, older-patch hinttests/— 5 new bats + 4 new Pester tests for the patch-line selection (numeric sort,8.50.xmust not count as the8.5line)README.md,version.txt, install scripts — 1.9.1Testing Done
phpvm installon Linux: no[3] …job noise, and the shell stays in the directory it started in. (Only verifiable once merged, or by sourcinglinux/phpvm.shfrom this branch directly —phpvm upgradestill serves 1.9.0 until this lands.)irm … | iexagainst a freshPHPVM_DIR— the one path that cannot be unit tested.Not fixed here
phpvm installon Windows prefers the thread-safe build (Resolve-PHPURLtries the non-ntsURL first), but windows.php.net recommends NTS for CLI and FastCGI; TS is only needed for Apachemod_php, which phpvm never touches. Worth flipping, but it changes what gets installed, so it belongs in its own PR.