Found reviewing PR #232 (Windows JDK bootstrap). Verified against install.ps1 as merged.
What happens
Install-EmbeddedJdk removes the existing JDK before the replacement exists:
if (Test-Path $staging) { Remove-Item -Recurse -Force $staging }
if (Test-Path $EMBEDDED_JDK_DIR) { Remove-Item -Recurse -Force $EMBEDDED_JDK_DIR } # install.ps1:203
New-Item -ItemType Directory -Force -Path $staging | Out-Null
try {
Expand-Archive -Path $zip -DestinationPath $staging -Force # install.ps1:207
...
If Expand-Archive throws, the catch writes an error and returns $null, Resolve-Java returns $false and the script exits 1 — with <Target>\jdk already deleted.
Consequence
A previously working installation is left with no JVM at all, and the failure that causes it is realistic rather than exotic: the unpack needs the 180 MB zip plus roughly 300 MB expanded plus the ~309 MB jar in the same tree, so running out of disk lands squarely in this window. The user's next REPL launch fails, and the installer that broke it is the one they will re-run to fix it (see the re-download issue).
Suggested fix
Stage, then swap: unpack into $staging, verify bin\java.exe exists, and only then remove $EMBEDDED_JDK_DIR and move the new tree into place. The move is already the last step — only the delete has to travel with it.
The $staging delete on the line above is fine as it is: that directory is scratch by construction.
Found reviewing PR #232 (Windows JDK bootstrap). Verified against
install.ps1as merged.What happens
Install-EmbeddedJdkremoves the existing JDK before the replacement exists:If
Expand-Archivethrows, thecatchwrites an error and returns$null,Resolve-Javareturns$falseand the script exits 1 — with<Target>\jdkalready deleted.Consequence
A previously working installation is left with no JVM at all, and the failure that causes it is realistic rather than exotic: the unpack needs the 180 MB zip plus roughly 300 MB expanded plus the ~309 MB jar in the same tree, so running out of disk lands squarely in this window. The user's next REPL launch fails, and the installer that broke it is the one they will re-run to fix it (see the re-download issue).
Suggested fix
Stage, then swap: unpack into
$staging, verifybin\java.exeexists, and only then remove$EMBEDDED_JDK_DIRand move the new tree into place. The move is already the last step — only the delete has to travel with it.The
$stagingdelete on the line above is fine as it is: that directory is scratch by construction.