Enhance logging for Unix elevation failure

pull/7639/head
maximilionus 2025-07-23 17:23:39 +03:00
parent bf1c601cb5
commit 69c1f4713e
1 changed files with 9 additions and 4 deletions

View File

@ -53,13 +53,18 @@ public class CoreAdminHandler
_linuxSudoPid = cmdTask.ProcessId;
process = Process.GetProcessById(_linuxSudoPid);
try
{
process = Process.GetProcessById(_linuxSudoPid);
await Task.Delay(5000); // Sudo exit on wrong password takes 2-4 sec.
if (process.HasExited || process is null)
if (process.HasExited)
throw new InvalidOperationException("Process exited too soon, likely improper sudo password.");
}
catch (Exception ex)
{
_linuxSudoPid = -1;
throw new Exception(ResUI.FailedToRunCore);
throw new Exception(ResUI.FailedToRunCore, ex);
}
return process;