Skip to content

Shut down and quit: offer another minute instead of only Force off - #149

Merged
A21-devs merged 3 commits into
mainfrom
feat/wait-another-minute
Dec 4, 2026
Merged

A21-devs merged 3 commits into
mainfrom
feat/wait-another-minute

Conversation

@A21-devs

@A21-devs A21-devs commented Dec 4, 2026

Copy link
Copy Markdown
Owner

Closes #146

shutDownAllAndQuit gave every guest 60 seconds after the power button press and then asked Force off / Cancel. A Windows guest installing updates on shutdown regularly needs longer, and Force off there loses the update.

The question now has three buttons: Wait another minute (the default), Force off and quit, Cancel. The wait and the question are a loop now, so it can be extended as often as needed, and the message says how long the app has been waiting ("has not shut down in 3 minutes"). While it waits, the window goes back to the tray, which already says the app quits once the VMs are off.

Picked the second option from the issue (no new setting): it needs no decision up front and the occasional slow shutdown is exactly when you find out you want it.

Also in here, because the loop makes it reachable: VmRunner.waitForExit left an exit listener on the child process every time it timed out, so ten extra minutes of waiting would have printed Node's max listeners warning. It removes the listener now.

Testing

  • npm run typecheck, npm test (153 pass), npm run build
  • npm run test:qemu (170 pass, real headless VMs in a temp folder) since vmRunner changed
  • npm run smoke: SMOKE OK
  • The dialog itself is still only checked by reading it; Tests for the close and quit flow #147 covers making this flow testable.

@A21-devs A21-devs added enhancement New feature or request ui labels Dec 4, 2026
The same process can be waited on more than once (the quit flow is about
to wait another minute at the user's request), and every timed-out wait
left an 'exit' listener on the child process, which trips Node's max
listeners warning after ten of them.
A minute after the power button press, any guest still running got a
question with Force off and Cancel. A Windows guest installing updates
on shutdown, or a Linux guest with a slow service, regularly needs
longer than that, and Force off at that point loses the update.

The question now offers Wait another minute, which is the default
button, and says how long the app has been waiting. Cancel still stops
the quit. The window goes back to the tray while it waits.

@A21-devs A21-devs left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the whole diff. The loop is right as far as I can tell: waitForExit resolves true straight away for a VM that is no longer in running, so a guest that exits while the question is open drops out of waiting on the next round instead of being waited on for nothing, a per-VM Force off from the tray ends the wait the same way, and Cancel still leaves shuttingDown false with the tray menu rebuilt. The listener removal in waitForExit is the right call now that the same process is waited on repeatedly. One nit on the wording.

Comment thread src/main/index.ts
detail: 'Force off loses anything unsaved inside the guest.',
buttons: ['Force off and quit', 'Cancel'],
cancelId: 1,
message: `${waiting.join(', ')} ${waiting.length === 1 ? 'has' : 'have'} not shut down ${minutes === 1 ? 'within a minute' : `in ${minutes} minutes`}.`,

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: minutes counts rounds of the question, not time, so it undercounts whenever the question sat unanswered for a while. Leave the dialog up for ten minutes, click Wait another minute, and the next one says "in 2 minutes" for a guest that has been shutting down for twelve. A Date.now() taken before the loop and rounded to minutes would read true in that case, and it is the same one line.

Also in the detail two lines down: "anything unsaved inside it" reads oddly when the message above named three VMs.

@A21-devs

A21-devs commented Dec 4, 2026

Copy link
Copy Markdown
Owner Author

Fair nit, took both parts: the count now comes from a Date.now() taken before the loop (rounded to minutes, floor of 1), so a question that sat open is included, and the detail line says "them" when more than one VM is named.

Rechecked: npm run typecheck, npm test (153), npm run build, npm run smoke (SMOKE OK).

The question's minute count came from the number of rounds, so a
question left open for a while made it read short. Take it from a
timestamp instead, and make the detail line agree with the number of
VMs named above it.

@A21-devs A21-devs left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second pass over 1ea94be. The nit is fixed both ways: minutes comes from since now, so time spent with the question open counts, and the detail line agrees with the number of VMs named. The Math.max(1, ...) floor keeps the first round reading "within a minute" even if the wait came back a few hundred milliseconds early, which is the case that would otherwise say "in 0 minutes".

One thing I looked at and am happy to leave: Math.round means 90 seconds reads as "in 2 minutes", slightly ahead of the real wait. Rounding to the nearest minute is how a person would say it, and the number is there to show the wait is getting long, not as a measurement, so it does not need to change.

Nothing else outstanding from either pass.

@A21-devs
A21-devs merged commit e206f3d into main Dec 4, 2026
1 check passed
@A21-devs
A21-devs deleted the feat/wait-another-minute branch December 4, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shut down and quit: one minute is short for a guest installing updates

1 participant