diff --git a/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs b/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs index 3eff7e3984d..be2a2dd6673 100644 --- a/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs @@ -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 @@ private List CreateResultsFromQuery(Query query) 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 @@ private List CreateResultsFromQuery(Query query) { 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 @@ private List CreateResultsFromQuery(Query query) return sortedResults; } - - private static async Task DelayAndReQueryAsync(string query) - { - await Task.Delay(500); - _context.API.ChangeQuery(query, true); - } } } diff --git a/Plugins/Flow.Launcher.Plugin.ProcessKiller/ProcessHelper.cs b/Plugins/Flow.Launcher.Plugin.ProcessKiller/ProcessHelper.cs index 0932955d6bc..0acc39fbb1c 100644 --- a/Plugins/Flow.Launcher.Plugin.ProcessKiller/ProcessHelper.cs +++ b/Plugins/Flow.Launcher.Plugin.ProcessKiller/ProcessHelper.cs @@ -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 @@ public void TryKill(Process p) if (!p.HasExited) { p.Kill(); + p.WaitForExit(50); } } catch (Exception e)