Fix kill process for linux
Some checks are pending
release Linux / build (Release) (push) Waiting to run
release macOS / build (Release) (push) Waiting to run
release Windows desktop (Avalonia UI) / build (Release) (push) Waiting to run
release Windows / build (Release) (push) Waiting to run

This commit is contained in:
2dust 2025-04-25 16:36:28 +08:00
parent c6d347d49a
commit 0032a3d27a

View file

@ -155,6 +155,12 @@ public class CoreHandler
{ {
try try
{ {
if (_linuxSudoPid > 0)
{
await KillProcessAsLinuxSudo();
_linuxSudoPid = -1;
}
if (_process != null) if (_process != null)
{ {
await ProcUtils.ProcessKill(_process, true); await ProcUtils.ProcessKill(_process, true);
@ -166,12 +172,6 @@ public class CoreHandler
await ProcUtils.ProcessKill(_processPre, true); await ProcUtils.ProcessKill(_processPre, true);
_processPre = null; _processPre = null;
} }
if (_linuxSudoPid > 0)
{
await KillProcessAsLinuxSudo();
}
_linuxSudoPid = -1;
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -390,7 +390,7 @@ public class CoreHandler
await File.WriteAllTextAsync(shFilePath, sb.ToString()); await File.WriteAllTextAsync(shFilePath, sb.ToString());
await Utils.SetLinuxChmod(shFilePath); await Utils.SetLinuxChmod(shFilePath);
Logging.SaveLog(shFilePath); //Logging.SaveLog(shFilePath);
return shFilePath; return shFilePath;
} }