feat: kill VMs using quickemu --kill when running quickemu >= 4.9.6

This commit is contained in:
Martin Wimpress 2024-07-01 01:23:57 +01:00 committed by Martin Wimpress
parent bdce26ebb6
commit dbc5e3f551
4 changed files with 29 additions and 2 deletions

View File

@ -9,6 +9,7 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:gettext_i18n/gettext_i18n.dart';
import 'package:path/path.dart' as path;
import 'package:process_run/shell.dart';
import 'package:version/version.dart';
import '../globals.dart';
import '../mixins/preferences_mixin.dart';
@ -337,11 +338,18 @@ class _ManagerState extends State<Manager> with PreferencesMixin {
),
],
),
).then((result) {
).then((result) async {
result = result ?? false;
if (result) {
var shell = Shell();
shell.run(['killall', currentVm].join(' '));
// If Quickemu is newer than 4.9.6, use the new --kill option
// which is macOS compatible.
var quickemuVersion = Version.parse(await fetchQuickemuVersion());
if (quickemuVersion >= Version(4, 9, 6)) {
shell.run(['quickemu', '--vm', '$currentVm.conf', '--kill'].join(' '));
} else {
shell.run(['killall', currentVm].join(' '));
}
setState(() {
_activeVms.remove(currentVm);
});

View File

@ -882,6 +882,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
version:
dependency: "direct main"
description:
name: version
sha256: "3d4140128e6ea10d83da32fef2fa4003fccbf6852217bb854845802f04191f94"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
vm_service:
dependency: transitive
description:

View File

@ -1100,6 +1100,16 @@
"source": "hosted",
"version": "2.1.4"
},
"version": {
"dependency": "direct main",
"description": {
"name": "version",
"sha256": "3d4140128e6ea10d83da32fef2fa4003fccbf6852217bb854845802f04191f94",
"url": "https://pub.dev"
},
"source": "hosted",
"version": "3.0.2"
},
"vm_service": {
"dependency": "transitive",
"description": {

View File

@ -26,6 +26,7 @@ dependencies:
url_launcher: ^6.3.0
shared_preferences: ^2.2.3
tuple: ^2.0.2
version: ^3.0.2
window_size:
git:
url: https://github.com/google/flutter-desktop-embedding.git