Windows 0.3.7 updater exit and Windows session cleanup reliability; no private history or other platform changes
This commit is contained in:
@@ -8,6 +8,21 @@ internal static class ClientShutdownScope
|
||||
internal static bool IsUnambiguous(string expected, int session, IEnumerable<Instance> processes)
|
||||
=> processes.Where(p => p.SessionId == session).All(p => !string.IsNullOrWhiteSpace(p.Executable)
|
||||
&& string.Equals(Path.GetFullPath(p.Executable), Path.GetFullPath(expected), StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
// Call only after path/session verification and pinning exact handles.
|
||||
// All instances consume one shared budget; a timeout never kills a client.
|
||||
internal static bool WaitForExit(IEnumerable<System.Diagnostics.Process> processes, TimeSpan? budget = null)
|
||||
{
|
||||
var watch = System.Diagnostics.Stopwatch.StartNew();
|
||||
var limit = budget ?? TimeSpan.FromSeconds(90);
|
||||
foreach (var process in processes)
|
||||
{
|
||||
var remaining = (int)Math.Clamp(limit.TotalMilliseconds - watch.ElapsedMilliseconds, 0, int.MaxValue);
|
||||
if (!process.HasExited && (remaining == 0 || !process.WaitForExit(remaining))) return false;
|
||||
if (process.ExitCode != 0) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
internal static bool SelfTest()
|
||||
{
|
||||
const string expected = @"C:\fixture\installed\VPNPlus.exe";
|
||||
|
||||
Reference in New Issue
Block a user