Graceful Softnet termination (#434)

This commit is contained in:
Nikolay Edigaryev
2023-03-16 18:37:46 +04:00
committed by GitHub
parent 066f585c53
commit d7561cab0b
+7 -1
View File
@@ -363,7 +363,13 @@ struct Run: AsyncParsableCommand {
VMView(vm: vm!).onAppear {
NSWindow.allowsAutomaticWindowTabbing = false
}.onDisappear {
NSApplication.shared.terminate(self)
let ret = kill(getpid(), SIGINT)
if ret != 0 {
// Fallback to the old termination method that doesn't
// propagate the cancellation to Task's in case graceful
// termination via kill(2) is not successful
NSApplication.shared.terminate(self)
}
}
}.frame(width: CGFloat(vm!.config.display.width), height: CGFloat(vm!.config.display.height))
}.commands {