fix kill command to honor "Last Query Style"

This commit is contained in:
Ioannis G 2023-06-04 06:20:50 +03:00
parent bbaa388ff4
commit 6bdf6ac1ce
No known key found for this signature in database
GPG key ID: EAC0E4E5E36AC49E
2 changed files with 7 additions and 11 deletions

View file

@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using Flow.Launcher.Infrastructure;
using System.Threading.Tasks;
namespace Flow.Launcher.Plugin.ProcessKiller
{
@ -89,7 +88,8 @@ namespace Flow.Launcher.Plugin.ProcessKiller
Action = (c) =>
{
processHelper.TryKill(p);
_ = DelayAndReQueryAsync(query.RawQuery); // Re-query after killing process to refresh process list
// Re-query to refresh process list
_context.API.ChangeQuery(query.RawQuery, true);
return true;
}
});
@ -114,7 +114,8 @@ namespace Flow.Launcher.Plugin.ProcessKiller
{
processHelper.TryKill(p.Process);
}
_ = DelayAndReQueryAsync(query.RawQuery); // Re-query after killing process to refresh process list
// Re-query to refresh process list
_context.API.ChangeQuery(query.RawQuery, true);
return true;
}
});
@ -122,11 +123,5 @@ namespace Flow.Launcher.Plugin.ProcessKiller
return sortedResults;
}
private static async Task DelayAndReQueryAsync(string query)
{
await Task.Delay(500);
_context.API.ChangeQuery(query, true);
}
}
}

View file

@ -1,4 +1,4 @@
using Flow.Launcher.Infrastructure;
using Flow.Launcher.Infrastructure;
using Flow.Launcher.Infrastructure.Logger;
using System;
using System.Collections.Generic;
@ -75,6 +75,7 @@ namespace Flow.Launcher.Plugin.ProcessKiller
if (!p.HasExited)
{
p.Kill();
p.WaitForExit(50);
}
}
catch (Exception e)