Repository navigation
show installer progress during in-app updates on windows - #19630
Conversation
The updater runs the NSIS installer with /S, so nothing was visible between RStudio closing and the new version starting, a minute or more later. Given /update, the installer now leaves silent mode at the end of .onInit and shows its progress page only; the other pages are skipped. The restart prompt says that RStudio will close and reopen, and the update-failure messages are topmost so that they are not hidden behind another application. Addresses #17173
NsisMultiUser elevates an all-users install by starting a second instance, which began again at the Welcome page. It sets $InstallShowPagesBeforeComponents to 0 there for the script to skip the pages before its own; the Welcome page's pre-callback now does. Addresses #19631
RStudio E2E - all platformsAll tests passed!
All platforms - commit |
gtritchie
left a comment
There was a problem hiding this comment.
One functional issue (Ignore on the new file-error dialog), plus a few smaller notes inline. Reviewed by reading the template against NsisMultiUser at the pinned commit; I haven't built or run an installer.
| ; and would have quit on an error rather than left it for that page. | ||
| ; | ||
| ${If} $UpdateMode = 1 | ||
| SetSilent normal |
There was a problem hiding this comment.
With /update no longer silent, a file that can't be written raises NSIS's Abort/Retry/Ignore dialog. AllowSkipFiles is on by default and the template never sets it, so Ignore is offered: it skips that file and the install carries on. The remaining sections run, UAC_AsUser_ExecShell (line 517) relaunches RStudio on a mix of old and new files, and .onInstFailed never runs.
Under /S the dialog's silent default was Abort, which led to the repair message. The manual test in the description covered Abort only.
Suggested fix: AllowSkipFiles off (Retry/Cancel only), or skip the relaunch in the Core section when the error flag is set.
There was a problem hiding this comment.
Agreed that Ignore must not end in a relaunch. Fixed in 9d9e583: given /update, the Core section clears the error flag before the payload and aborts if it is set afterwards, so Ignore ends like Abort ("Installation Aborted", then the repair message). Checked in the VM with a locked payload file: Ignore gives "Some files could not be replaced." and then the repair message, with no relaunch; a normal update still relaunches.
One correction: that dialog's silent default is Ignore, not Abort (script.cpp: mb |= IDIGNORE << 21; // default for silent installers, in 3.08 and 3.12). So the old /S /update skipped a locked file without asking and relaunched on mixed files, and plain /S installs still do. I left AllowSkipFiles alone, since turning it off would also change plain /S (skip becomes fail) and interactive installs.
| logger().logErrorMessage(`${file} is gone; not installing`); | ||
| return false; | ||
| } | ||
| // /S asks for no questions, not for no window: given /update, the |
There was a problem hiding this comment.
"/S asks for no questions" no longer holds: after SetSilent normal a file error asks Abort/Retry/Ignore. Same for "runs unattended" in the header comment (line 92) and in windows-authenticode.ts.
There was a problem hiding this comment.
Fixed in 78ec197. The header comment, the signature-check comment here and the one in windows-authenticode.ts no longer say silently or unattended, and the launchInstaller comment is rewritten.
| return false; | ||
| } | ||
| // /S asks for no questions, not for no window: given /update, the | ||
| // installer still shows its progress page (see NSIS.template.in). |
There was a problem hiding this comment.
The spawn below still passes windowsHide: true (STARTF_USESHOWWINDOW + SW_HIDE), which contradicts this comment. Your test shows the window appears anyway, but for a per-user update the spawned installer is the process that shows the window, so this relies on how Windows applies wShowWindow to NSIS's first ShowWindow call. windowsHide only matters for console windows otherwise, so dropping it seems the safer choice.
| downloadingUpdateMessage=Downloading RStudio {0}... | ||
| updateDownloadedCaption=Update Ready to Install | ||
| updateDownloadedMessage=RStudio {0} has been downloaded. Restart RStudio now to finish installing it? | ||
| updateDownloadedMessage=RStudio {0} has been downloaded. Restart RStudio now to finish installing it? RStudio will close while the update is installed, which can take a few minutes, and reopen when it is done. |
There was a problem hiding this comment.
This message is shared with macOS (DesktopApplicationHeader.java:824, no platform branch), where Squirrel swaps the bundle in seconds, so "which can take a few minutes" is Windows-only. The question also no longer ends the message, though the Restart Now / Later buttons answer it. Same for the _fr string.
There was a problem hiding this comment.
Fixed in b5e24d0: "RStudio {0} has been downloaded. RStudio will close while the update is installed and reopen when it is done. Restart RStudio now to finish installing it?" (French to match). That's true on macOS as well, since Squirrel quits and relaunches. On Windows the progress window now covers the wait.
| ${EndIf} | ||
| FunctionEnd | ||
|
|
||
| ; The Welcome page is also skipped where NsisMultiUser asks for the pages |
There was a problem hiding this comment.
Nit: $InstallShowPagesBeforeComponents = 0 doesn't only mark the elevated instance. MULTIUSER_SET_ERROR (NsisMultiUser.nsh:203) also sets it in the outer instance on a non-silent init error, e.g. /allusers /currentuser together. Skipping Welcome there is what NsisMultiUser intends for the variable, so the behavior is fine; only this comment (and "apart from that repeated Welcome page" in the description) is slightly off.
There was a problem hiding this comment.
Right, MULTIUSER_SET_ERROR sets it too, and skipping Welcome there goes straight to the install-mode page's error message. Comment updated in 9d9e583, and I've fixed the description.
Ignore on NSIS's file-error dialog skips a file that cannot be written and carries on (it is also the silent default, so /S has always done this), and the update then relaunched RStudio on a mix of old and new files. Given /update, the installer now checks the error flag after extracting the payload and aborts, so it ends as it does on Abort: the installation needs repairing. Also corrects the comment on when NsisMultiUser hides the pages before its own. Addresses #17173
Given /update, the installer shows its progress page. windowsHide asks for SW_HIDE on the first window shown, which only did not hide that page because of how Windows applies it to NSIS's dialog; the installer is a GUI program, so there is no console window for it to hide. Comments no longer say that the installer runs silently or unattended. Addresses #17173
The message is shared with macOS, where Squirrel replaces the bundle in seconds, so it no longer says the update can take a few minutes, and it ends with its question again. Addresses #17173
gtritchie
left a comment
There was a problem hiding this comment.
Thanks, all addressed, and thanks for the correction on the silent default.
Intent
On Windows, an in-app update ran the installer fully silent. After "Restart Now" (and the UAC prompt, for an all-users install) nothing was visible until the new RStudio appeared a minute or more later, which reads as the update having done nothing.
Also, in an interactive all-users install the Welcome page was shown a second time after the UAC prompt.
Addresses #17173. Fixes #19631.
Approach
Installer shows its progress page for
/update. At the end of.onInitthe installer leaves silent mode (SetSilent normal) when/updatewas given. Pre-callbacks skip the Welcome, Directory and Finish pages, and NsisMultiUser skips its install-mode page itself, because its init ran silently with the mode on the command line. The header reads "Updating RStudio / RStudio will reopen when the update has been installed." The window closes by itself when the install is done, and RStudio is relaunched as before.Everything before that still runs silent. The wait for
rstudio.exe, the elevation and NsisMultiUser's checks are unchanged, since they all happen before the switch.Same updater arguments.
updater.tsstill passes/S /update, so the installer decides, and builds already installed get the progress window the first time they update to a build that has this installer. The updater no longer starts the installer withwindowsHide, which only did not hide the progress page because of how Windows applies it to NSIS's dialog.File errors are no longer silent. A file that cannot be replaced now raises NSIS's Abort/Retry/Ignore dialog. Under
/S, NSIS chose Ignore without asking, and RStudio was relaunched on a mix of old and new files. Now Ignore also fails the update: the installer checks the error flag after extracting. After Abort or Ignore the page stays on "Installation Aborted" until it is closed, and then the existing failure message is shown.Update-failure messages are topmost. For an all-users install they come from the unelevated outer instance after the elevated one has closed, and they opened behind whichever application was active.
Restart prompt text (en, fr) now says that RStudio will close while the update is installed and reopen when it is done.
Welcome page after elevation (Windows installer shows the Welcome page again after the UAC prompt #19631). The Welcome page's pre-callback also skips it when NsisMultiUser's
$InstallShowPagesBeforeComponentsis 0, which is how it marks the elevated instance it starts from the install-mode page.Plain silent installs (
/Swithout/update) behave as before, and so do interactive installs apart from the Welcome page, which is now skipped wherever NsisMultiUser hides the pages before its own: after the UAC prompt, and before its message for an invalid command line.Automated Tests
None; this is installer UI. Checked by hand in a Windows 11 ARM64 VM with installers compiled from this template (NSIS 3.08, a small stand-in payload registered under a separate product name, started with the same
spawnoptions aslaunchInstaller()):--after-failed-update/S /alluserswithout/updateA per-user update was also re-run with
windowsHideoff, as the updater now starts the installer: progress window shown, RStudio relaunched.Also run once with this PR's CI installer (
rstudio-app-windows-x64, NSIS 3.12) as/S /currentuser /updateover an installed RStudio: the progress window was up for about 95 seconds while the files were replaced, then RStudio reopened on the new build.Not run: an update started from inside RStudio (a PR build is unsigned, so the updater will not launch it), an all-users update with the real payload, and the "still running" message, whose only change is the topmost flag.
QA Notes
From an older hourly build on Windows, accept an update and choose Restart Now. A window titled "RStudio Setup" with the header "Updating RStudio" and a progress bar should be visible until RStudio reopens; for an all-users install it appears after the UAC prompt.
Documentation
None needed.
Checklist
NEWS.md(for Windows installer shows the Welcome page again after the UAC prompt #19631; in-app updates are unreleased and need none)findComponents, needs a built rsession in the worktree and is unrelated)