From a442823bfef567d22279d6c4bc14ecb1b8869bb6 Mon Sep 17 00:00:00 2001 From: xkeyC <3334969096@qq.com> Date: Mon, 29 Jan 2024 21:22:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=B8=E6=88=8F=E9=9D=9E=E6=AD=A3=E5=B8=B8?= =?UTF-8?q?=E9=80=80=E5=87=BA=E6=97=B6=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ui/home/home_ui_model.dart | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/ui/home/home_ui_model.dart b/lib/ui/home/home_ui_model.dart index 54c82d0..944201f 100644 --- a/lib/ui/home/home_ui_model.dart +++ b/lib/ui/home/home_ui_model.dart @@ -570,14 +570,12 @@ class HomeUIModel extends BaseUIModel { _isGameRunning[installPath] = true; notifyListeners(); try { + late ProcessResult result; if (processorAffinity == null) { - ProcessResult result = await Process.run(launchExe, args); - dPrint('Exit code: ${result.exitCode}'); - dPrint('stdout: ${result.stdout}'); - dPrint('stderr: ${result.stderr}'); + result = await Process.run(launchExe, args); } else { dPrint("set Affinity === $processorAffinity launchExe === $launchExe"); - ProcessResult result = await Process.run("cmd.exe", [ + result = await Process.run("cmd.exe", [ '/C', 'Start', '"StarCitizen"', @@ -587,9 +585,13 @@ class HomeUIModel extends BaseUIModel { launchExe, ...args ]); - dPrint('Exit code: ${result.exitCode}'); - dPrint('stdout: ${result.stdout}'); - dPrint('stderr: ${result.stderr}'); + } + dPrint('Exit code: ${result.exitCode}'); + dPrint('stdout: ${result.stdout}'); + dPrint('stderr: ${result.stderr}'); + if (result.exitCode != 0) { + showToast(context!, + "游戏非正常退出\nexitCode=${result.exitCode}\nstdout=${result.stdout}\nstderr=${result.stderr}"); } final launchFile = File("$installPath\\loginData.json");