Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gracefully stop vm on tart stop #808

Merged
merged 3 commits into from
Apr 30, 2024

Conversation

torarnv
Copy link
Contributor

@torarnv torarnv commented Apr 29, 2024

We were letting the CancellationError bubble up all the way until
it terminated app, which meant we didn't hit the shutdown code
in run(), stopping the VM and the network.

We now catch CancellationError and proceed to gracefully shut down.

We only stop the VM if it's still running, as a VM that has been
stopped via the menu can't be stopped again.

We were letting the CancellationError bubble up all the way until
it terminated app, which meant we didn't hit the shutdown code
in run(), stopping the VM and the network.

We now catch CancellationError and proceed to gracefully shut down.

We only stop the VM if it's still running, as a VM that has been
stopped via the menu can't be stopped again.
Normally the quit action will result in AppKit calling exit(),
but we want to gracefully shut down the VM, so we use the same
path as for closing of the VM window, namely signal our own
process with SIGINT or SIGUSR1.

If that doesn't work we let AppKit terminate as before.

This fixes the "Warning: NSActivity <_NSActivityAssertion:
0x600001f785a0> was ended multiple times" warning seen on
the console when quitting Tart via the menu.
This ensures that the VM window has been shown by the time we
activate, so that we consistently activate and bring the VM
window to the front.
@torarnv torarnv force-pushed the gracefully-stop-vm-on-tart-stop branch from 88a84ee to 43652de Compare April 30, 2024 09:38
@fkorotkov fkorotkov merged commit c6e8d0b into cirruslabs:main Apr 30, 2024
5 checks passed
@torarnv torarnv deleted the gracefully-stop-vm-on-tart-stop branch April 30, 2024 13:49
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.

None yet

3 participants